local plr = game.Players.LocalPlayer local hum = plr.Character.HumanoidRootPart if hum.Position.Z == 4530 then print("hit") hum.CFrame = CFrame.new(-51, 65, 4530.58984) elseif hum.Position.Z == 5110.58984 then print("hit") hum.CFrame = CFrame.new(-53, 65, 8356.58984) elseif hum.Position.Z == 9499.89258 then print("hit") hum.CFrame = CFrame.new(-60.965944, -359.6, 9525.3958) wait(5) local strength = plr.Character.HumanoidRootPart.BodyForce strength.Force = Vector3.new(0, 0, 2000) game.Workspace.Gravity = 0 plr.Character.HumanoidRootPart.CFrame = CFrame.new(-123, 53, 163) end
btw if u want me to indent this then i tell u now, idk what indent is or how to do it
Your script only runs/triggers once when the game has loaded. If you link it with an event/loop, it'll check these if statements multiple times and achieve what you want.
Even if we linked this script up with an event, it will never run. Why? Because you are comparing decimal values of positions.
The position might say '1.000', but in reality it shows up as '1.000000001' or something similar along those lines. With that in mind, the script will never run because 1.000 doesn't equal 1.000000001.
How to improve what you are trying to achieve
Magnitude is the distance in studs between two vector points. If you want the player to be in a certain area to teleport them, check if they are in a magnitude of an area, then teleport them.
Rather than checking if they are in a certain Z position, use a part and apply a touched event to a part and teleport them accordingly
This will be more consistent than checking if it's equal as you are allowing for more tolerance for your if statements to trigger.
Hope this answers your question or gives you a better alternative!