matekaOSF2

madcitytp

Sep 2nd, 2020 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. function tp(x, y, z)
  2. local player = game.Players.LocalPlayer
  3. local char = player.Character
  4. local root = char:WaitForChild("HumanoidRootPart")
  5. local a = 50;
  6. moving = true;
  7. if x < root.Position.X then
  8. while x < root.Position.X do
  9. wait()
  10. root.CFrame = CFrame.new(Vector3.new(root.Position.X - a, root.Position.Y, root.Position.Z))
  11. end
  12. end;
  13. if z < root.Position.Z then
  14. while z < root.Position.Z do
  15. wait()
  16. root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y, root.Position.Z - a))
  17. end
  18. end;
  19. if x > root.Position.X then
  20. while x > root.Position.X do
  21. wait()
  22. root.CFrame = CFrame.new(Vector3.new(root.Position.X + a, root.Position.Y, root.Position.Z))
  23. end
  24. end;
  25. if z > root.Position.Z then
  26. while z > root.Position.Z do
  27. wait()
  28. root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y, root.Position.Z + a))
  29. end
  30. end;
  31. if y < root.Position.Y then
  32. while y < root.Position.Y do
  33. wait()
  34. root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y - a, root.Position.Z))
  35. end
  36. end;
  37. if y > root.Position.Y then
  38. while y > root.Position.Y do
  39. wait()
  40. root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y + a, root.Position.Z))
  41. end
  42. end;
  43. moving = false
  44. game.Players.LocalPlayer.Character:MoveTo(Vector3.new(x, y, z))
  45. end;
  46.  
  47. spawn(function()
  48. game:getService("RunService"):BindToRenderStep("", 0, function()
  49. if not game.Players.LocalPlayer.Character:findFirstChildOfClass("Humanoid") then
  50. return
  51. end;
  52. if moving == true then
  53. game.Players.LocalPlayer.Character:findFirstChildOfClass("Humanoid"):ChangeState(11)
  54. end
  55. end)
  56. end)
Add Comment
Please, Sign In to add comment