Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local serv = game:GetService("PathfindingService")
- local human = script.Parent:WaitForChild("Humanoid")
- local body = script.Parent:FindFirstChild("Torso") or script.Parent:FindFirstChild("HumanoidRootPart")
- local dest = workspace:FindFirstChild("Spot")
- local path = serv:CreatePath()
- path:ComputeAsync(body.Position,dest.Position)
- if path.Status == Enum.PathStatus.Success then
- local wayPoints = path:GetWaypoints()
- for i = 1,#wayPoints do
- local point = wayPoints[i]
- human:MoveTo(point.Position)
- local success = human.MoveToFinished:Wait()
- if point.Action == Enum.PathWaypointAction.Jump then
- human.WalkSpeed = 0
- wait(0.2)
- human.WalkSpeed = 16
- human.Jump = true
- end
- if not success then
- print("trying again")
- human.Jump = true
- human:MoveTo(point.Position)
- if not human.MoveToFinished:Wait() then
- break
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement