Pathfinding Service alternatives to MoveToFinished?

hi how do i use the pathfinding service without using movetofinished because it waits until all the path is completed until it makes a new paths which results in my npc walking past each other on the last tracked location then towards each other. the pathfindingservice won’t work with just MoveTo

Path:ComputeAsync(NPC.HumanoidRootPart.Position, Closest)
for _, v in pairs(Path:GetWaypoints()) do
   NPC.Humanoid:MoveTo(v.Position)
   NPC.Humanoid.MoveToFinished:Wait()
end
8 Likes

still need help i only have moveTo but pathfinding wouldn’t work without movetofinished otherwise it’s just moveTo making pathfindingservice unnecessary

lol can anyone see my post or what???

You just could use the basic road/speed formula and add a threshold at which you decide to change logic.
For an example:
+Distance from the designated point is 14 and your time has ran out to reach it, so you create a new path (if target exists) and follow it. (Of course you do set amount of time destined by the road/speed formula)

3 Likes

Sounds like a different problem. You should just check the distance between your character and the waypoint as an alternative.

this sounds a bit complicated and i’m not even sure if that can be done with pathfinding service

the problem is that MoveToFinished is locked and I cannot break out of it but it is also needed for the roblox built in pathfinding service to do its thing. everything else works

1 Like

i’ve attached my code now. how can i replace NPC.Humanoid.MoveToFinished:Wait() in order for the pathfinding service to work insteading of waiting until the character reaches the target before making new path?

3 Likes

I don’t know how to solve your issue, but here’s a tip: do this so it doesn’t move and wait a split second before moving again

Humanoid.MoveToFinished:Wait(0)
6 Likes

i tried this and unfortunately there is still a slight pause so its not different from :Wait() but thank you for your reply anyways. I thought i did something wrong for my post to be hidden that no one was replying

1 Like

still in need of help any help is greatly appreciated

It isn’t as complicated as you think,
This should give you a general idea

RangeToFinish = 10 -- Range Required to move on

for _,v in pairs(Path:GetWaypoints())
    NPC.Humanoid:MoveTo(v.Position) -- Moves to Waypoint

    while wait() do -- this loop is here to halt the code and to check Magnitude

       local Mag = (Character.HumanoidRootPart.Position - v.Position).Magnitude -- Distance of your Character and Waypoint

       if Mag <= RangeToFinish then -- If Character is in range
           break -- breaks the loop halting the code
       end

    end 
    -- continues
end

5 Likes