Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------
- -- SECTION KEY
- ---------------
- -- TOP
- --
- -- 01 02 03
- --
- -- 04 05 06
- --
- -- 07 08 09
- ------------
- -- MIDDLE
- --
- -- 10 11 12
- --
- -- 13 14 15
- --
- -- 16 17 18
- ------------
- -- BOTTOM
- --
- -- 19 20 21
- --
- -- 22 23 24
- --
- -- 25 26 27
- ---------------
- local Force = 1500
- local PlanetSize = Vector3.new(100, 100, 100)
- workspace.Gravity = 0
- local Players = game:GetService('Players')
- if workspace:FindFirstChild('Baseplate') then
- workspace.Baseplate:Destroy()
- end
- -- Generate Planet
- local Planet = Instance.new('Part')
- Planet.Name = 'Planet'
- Planet.Size = PlanetSize
- Planet.CFrame = CFrame.new(0, 0, 0)
- Planet.Shape = Enum.PartType.Block
- Planet.TopSurface = Enum.SurfaceType.Smooth
- Planet.BottomSurface = Enum.SurfaceType.Smooth
- Planet.Color = Color3.fromRGB(0, 200, 50)
- Planet.Anchored = true
- Planet.Parent = workspace
- local PnPosY = Planet.Position.Y + Planet.Size.Y / 2
- local PnNegY = Planet.Position.Y - Planet.Size.Y / 2
- local PnPosX = Planet.Position.X + Planet.Size.X / 2
- local PnNegX = Planet.Position.X - Planet.Size.X / 2
- local PnPosZ = Planet.Position.Z + Planet.Size.Z / 2
- local PnNegZ = Planet.Position.Z - Planet.Size.Z / 2
- Players.PlayerAdded:Connect(function(Player)
- Player.CharacterAdded:Connect(function(Character)
- local RootPart = Character:WaitForChild('HumanoidRootPart')
- local Human = Character:WaitForChild('Humanoid')
- RootPart.CFrame = CFrame.new(Planet.CFrame.X, PnPosY, Planet.CFrame.Z)
- local BodyForce = Instance.new('BodyForce', RootPart)
- local BodyGyro = Instance.new('BodyGyro', RootPart)
- local LastRegion = Instance.new('IntValue')
- LastRegion:GetPropertyChangedSignal('Value'):Connect(function()
- -- apply an opposing force when entering a new region to fix falling floatiness
- end)
- while wait(0.1) do
- if Human.Health <= 0 then
- break
- end
- local PrX = RootPart.Position.X
- local PrY = RootPart.Position.Y
- local PrZ = RootPart.Position.Z
- print()
- local Force = math.ceil(Force + (RootPart.Position - Planet.Position).magnitude ^ 1.5)
- print('force: ' .. Force)
- -- can this be cleaner?
- if PrX<PnPosX and PrX<PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {01}: (+X, -Y, +Z)')
- Force = math.ceil(Force / 1.5) -- too forceful when applied in multiple directions
- BodyForce.Force = Vector3.new(Force, -Force, Force)
- elseif PrX<PnPosX and PrX>PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {02}: (0, -Y, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(0, -Force, Force)
- elseif PrX>PnPosX and PrX>PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {03}: (-X, -Y, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, -Force, Force)
- elseif PrX<PnPosX and PrX<PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {04}: (+X, -Y, 0)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, -Force, 0)
- elseif PrX<PnPosX and PrX>PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {05}: (0, -Y, 0)')
- BodyForce.Force = Vector3.new(0, -Force, 0)
- elseif PrX>PnPosX and PrX>PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {06}: (-X, -Y, 0)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, -Force, 0)
- elseif PrX<PnPosX and PrX<PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {07}: (+X, -Y, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, -Force, -Force)
- elseif PrX<PnPosX and PrX>PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {08}: (0, -Y, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(0, -Force, -Force)
- elseif PrX>PnPosX and PrX>PnNegX and PrY>PnPosY and PrY>PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {09}: (-X, -Y, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, -Force, -Force)
- elseif PrX<PnPosX and PrX<PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {10}: (+X, 0, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, 0, Force)
- elseif PrX<PnPosX and PrX>PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {011}: (0, 0, +Z)')
- BodyForce.Force = Vector3.new(0, 0, Force)
- elseif PrX>PnPosX and PrX>PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {12}: (-X, 0, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, 0, Force)
- elseif PrX<PnPosX and PrX<PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {13}: (+X, 0, 0)')
- BodyForce.Force = Vector3.new(Force, 0, 0)
- elseif PrX<PnPosX and PrX>PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {14}: (0, 0, 0)')
- BodyForce.Force = Vector3.new(0, 0, 0)
- elseif PrX>PnPosX and PrX>PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {15}: (-X, 0, 0)')
- BodyForce.Force = Vector3.new(-Force, 0, 0)
- elseif PrX<PnPosX and PrX<PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {16}: (+X, 0, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, 0, -Force)
- elseif PrX<PnPosX and PrX>PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {17}: (0, 0, -Z)')
- BodyForce.Force = Vector3.new(0, 0, -Force)
- elseif PrX>PnPosX and PrX>PnNegX and PrY<PnPosY and PrY>PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {18}: (-X, 0, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, 0, -Force)
- elseif PrX<PnPosX and PrX<PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {19}: (+X, +Y, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, Force, Force)
- elseif PrX<PnPosX and PrX>PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {20}: (0, +Y, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(0, Force, Force)
- elseif PrX>PnPosX and PrX>PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ<PnPosZ and PrZ<PnNegZ then
- print('Player is in {21}: (-X, +Y, +Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, Force, Force)
- elseif PrX<PnPosX and PrX<PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {22}: (+X, +Y, 0)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, Force, 0)
- elseif PrX<PnPosX and PrX>PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {23}: (0, +Y, 0)')
- BodyForce.Force = Vector3.new(0, Force, 0)
- elseif PrX>PnPosX and PrX>PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ<PnPosZ and PrZ>PnNegZ then
- print('Player is in {24}: (-X, +Y, 0)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, Force, 0)
- elseif PrX<PnPosX and PrX<PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {25}: (+X, +Y, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(Force, Force, -Force)
- elseif PrX<PnPosX and PrX>PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {26}: (0, +Y, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(0, Force, -Force)
- elseif PrX>PnPosX and PrX>PnNegX and PrY<PnPosY and PrY<PnNegY and PrZ>PnPosZ and PrZ>PnNegZ then
- print('Player is in {27}: (-X, +Y, -Z)')
- Force = math.ceil(Force / 1.5)
- BodyForce.Force = Vector3.new(-Force, Force, -Force)
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement