local p = pf:CreatePath()
local enemy = targfind()
p:ComputeAsync(torso.Position, enemy.Position, 300)
local waypoints = p:GetWaypoints()
for i, v in pairs(waypoints) do
if v.Action == Enum.PathWaypointAction.Jump and human.FloorMaterial ~= nil then
human:ChangeState(Enum.HumanoidStateType.Jumping)
human:LoadAnimation(script.Parent.Animate.jump.JumpAnim):Play()
end
human:MoveTo(v.Position)
human.MoveToFinished:Connect(function()
finished = true
end)
print("reached")
repeat wait(.2) until finished
finished = false
end
The first block are when the path gets computed. This is only ran once in the function, and the function is called upon 3 times (the first time usually runs smoothly, but the subsequent ones start to slow down). "Reached" prints consistently until the second time this function is called, where the rate starts to decelerate (from .2 seconds to 3 seconds to 10 for the agent to reach the next waypoint). How can I make the path movement completely consistent?
