ShoccessX

cherry pick

Sep 15th, 2024 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. -- LocalScript
  2.  
  3. local player = game.Players.LocalPlayer
  4. local character = player.Character or player.CharacterAdded:Wait()
  5. local humanoid = character:WaitForChild("Humanoid")
  6. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  7.  
  8. local targetPosition = Vector3.new(-61, 3, -435)
  9.  
  10. -- Wait 130 seconds before executing the script
  11. wait(130)
  12.  
  13. -- Function to check the Z-coordinate
  14. local function checkZCoordinate()
  15. while true do
  16. local zPos = humanoidRootPart.Position.Z
  17. if zPos > -421 then
  18. print("Z-coordinate is greater than -421. Waiting 25 seconds...")
  19. wait(25) -- Wait for 25 seconds
  20.  
  21. -- Move the player to the specified coordinates using MoveTo
  22. humanoid:MoveTo(targetPosition)
  23.  
  24. local moveToConnection
  25. moveToConnection = humanoid.MoveToFinished:Connect(function(reached)
  26. if reached then
  27. print("Successfully moved to: " .. tostring(targetPosition))
  28. else
  29. print("Failed to reach the position, retrying...")
  30. humanoid:MoveTo(targetPosition)
  31. end
  32. moveToConnection:Disconnect()
  33. end)
  34. end
  35. wait(0.1) -- Check every 0.1 seconds
  36. end
  37. end
  38.  
  39. -- Start checking the Z-coordinate
  40. checkZCoordinate()
Advertisement
Add Comment
Please, Sign In to add comment