I want this npc to jump on blocks across an obby. It is able to do it when I test it in studio but when there are other players doing the obby at the same time the npc bugs out and becomes very slow and doesn’t jump resulting in it falling into water and dying.
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(workspace.Larry.Head.Position, workspace.goal.Position)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for _, waypoint in pairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
workspace.Larry.Humanoid.Jump = true
end
workspace.Larry.Humanoid:MoveTo(waypoint.Position)
workspace.Larry.Humanoid.MoveToFinished:Wait(2)
end
else
--print("Path unsuccessful")
wait(2)
end
I have tried variations of this script but the bug is still there. Any idea what could be causing this? Thanks.