Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LocalScript
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- local targetPosition = Vector3.new(-61, 3, -435)
- -- Wait 130 seconds before executing the script
- wait(130)
- -- Function to check the Z-coordinate
- local function checkZCoordinate()
- while true do
- local zPos = humanoidRootPart.Position.Z
- if zPos > -421 then
- print("Z-coordinate is greater than -421. Waiting 25 seconds...")
- wait(25) -- Wait for 25 seconds
- -- Move the player to the specified coordinates using MoveTo
- humanoid:MoveTo(targetPosition)
- local moveToConnection
- moveToConnection = humanoid.MoveToFinished:Connect(function(reached)
- if reached then
- print("Successfully moved to: " .. tostring(targetPosition))
- else
- print("Failed to reach the position, retrying...")
- humanoid:MoveTo(targetPosition)
- end
- moveToConnection:Disconnect()
- end)
- end
- wait(0.1) -- Check every 0.1 seconds
- end
- end
- -- Start checking the Z-coordinate
- checkZCoordinate()
Advertisement
Add Comment
Please, Sign In to add comment