Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tp(x, y, z)
- local player = game.Players.LocalPlayer
- local char = player.Character
- local root = char:WaitForChild("HumanoidRootPart")
- local a = 50;
- moving = true;
- if x < root.Position.X then
- while x < root.Position.X do
- wait()
- root.CFrame = CFrame.new(Vector3.new(root.Position.X - a, root.Position.Y, root.Position.Z))
- end
- end;
- if z < root.Position.Z then
- while z < root.Position.Z do
- wait()
- root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y, root.Position.Z - a))
- end
- end;
- if x > root.Position.X then
- while x > root.Position.X do
- wait()
- root.CFrame = CFrame.new(Vector3.new(root.Position.X + a, root.Position.Y, root.Position.Z))
- end
- end;
- if z > root.Position.Z then
- while z > root.Position.Z do
- wait()
- root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y, root.Position.Z + a))
- end
- end;
- if y < root.Position.Y then
- while y < root.Position.Y do
- wait()
- root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y - a, root.Position.Z))
- end
- end;
- if y > root.Position.Y then
- while y > root.Position.Y do
- wait()
- root.CFrame = CFrame.new(Vector3.new(root.Position.X, root.Position.Y + a, root.Position.Z))
- end
- end;
- moving = false
- game.Players.LocalPlayer.Character:MoveTo(Vector3.new(x, y, z))
- end;
- spawn(function()
- game:getService("RunService"):BindToRenderStep("", 0, function()
- if not game.Players.LocalPlayer.Character:findFirstChildOfClass("Humanoid") then
- return
- end;
- if moving == true then
- game.Players.LocalPlayer.Character:findFirstChildOfClass("Humanoid"):ChangeState(11)
- end
- end)
- end)
Add Comment
Please, Sign In to add comment