Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PLR1010 = game.Players.LocalPlayer
- local Paths = game:GetService("PathfindingService")
- local part = game:GetService("Workspace")["Elevators"]["Lobby"]["Floor"]
- function WalkTo(Vec3,TimeOut,...)
- local Options = {...}
- local hum = PLR1010.Character:FindFirstChild("Humanoid")
- local root = PLR1010.Character:FindFirstChild("HumanoidRootPart")
- if hum and root then
- on = true
- if TimeOut > 0 then
- coroutine.resume(coroutine.create(function()
- iter = 0
- repeat
- wait(.1)
- iter = iter + .1
- until not on or iter >= TimeOut
- on = false
- end))
- end
- local path = Paths:CreatePath(Options[1] or 2,Options[2] or 5,Options[3] or true)
- path:ComputeAsync(root.Position, Vec3)
- print(path)
- local waypoints = path:GetWaypoints()
- if path.Status == Enum.PathStatus.Success then
- for _,point in pairs(waypoints) do
- if not on then break end
- hum:MoveTo(point.Position)
- hum.MoveToFinished:Wait()
- end
- for Checks = 1,3 do
- if not on then break end
- hum:MoveTo(waypoints[#waypoints].Position)
- hum.MoveToFinished:Wait()
- end
- end
- on = false
- end
- end
- WalkTo(part.Position,0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement