Advertisement
Tinybang_Studio

Untitled

Oct 18th, 2019
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. local startpos = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
  2.  
  3. function tp(x,y,z)
  4. local valtomove = 4
  5. moving = true
  6. if x < game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X then
  7. while x < game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X do
  8. wait()
  9. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X-valtomove,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z))
  10. end
  11. end
  12. if z < game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z then
  13. while z < game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z do
  14. wait()
  15. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z-valtomove))
  16. end
  17. end
  18. if x > game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X then
  19. while x > game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X do
  20. wait()
  21. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X+valtomove,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z))
  22. end
  23. end
  24. if z > game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z then
  25. while z > game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z do
  26. wait()
  27. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z+valtomove))
  28. end
  29. end
  30. if y < game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y then
  31. while y < game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y do
  32. wait()
  33. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y-valtomove,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z))
  34. end
  35. end
  36. if y > game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y then
  37. while y > game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y do
  38. wait()
  39. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position.X,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y+valtomove,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Z))
  40. end
  41. end
  42. moving = false
  43. end
  44.  
  45. spawn (function()
  46. game:getService("RunService"):BindToRenderStep("",0,function()
  47. if not game.Players.LocalPlayer.Character:findFirstChildOfClass("Humanoid") then return end
  48. if moving == true then
  49. game.Players.LocalPlayer.Character:findFirstChildOfClass("Humanoid"):ChangeState(11)
  50. end
  51. end)
  52. end)
  53. game.Players.LocalPlayer.Character:MoveTo(Vector3.new(x,y,z))
  54.  
  55.  
  56. function tp2(x)
  57. tp(x.Position.X,x.Position.Y,x.Position.Z)
  58. end
  59.  
  60. for i,v in pairs(game.Workspace:GetChildren()) do
  61. if v.Name == "Gold Chest" or "Silver Chest" then
  62. tp2(v)
  63. wait(1)
  64. end
  65. end
  66.  
  67. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = startpos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement