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
still need help i only have moveTo but pathfinding wouldn’t work without movetofinished otherwise it’s just moveTo making pathfindingservice unnecessary
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)
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
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?
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
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