Pathfindingservice bug

So I’ve been making an evil robot for my game. It uses pathfindingservice to find it’s way to the target player.
The path waypoints are working, but the character isn’t moving to the given waypoints, in stead it’s moving to the player directly, without waypoints.
Here’s what I mean;
Here’s my movement script;
(That waypointscript that gets cloned into the physical waypoint just deletes the physical waypoint after one second to prevent getting the workspace full of parts and lag.)
Can anyone help me fix this problem?

the problem with your code is that you are not waiting until the robot moves to each point to correct this you can use the MoveToFinished event like this:

-- add this code under the Humanoid:MoveTo() line

you can read more about this event here Humanoid | Documentation - Roblox Creator Hub


If I do that, the robot replicates the path I walked, for example, if I walk forward and then 1 stud to the right, then 2 studs to the left, the robot doesn’t go to the left, but first to the right and then to the left.
I hope you understand this explanation.

is the robot following the path when you add my line?

Yes, it is but it’s also replicating the exact same path as I walked in stead of the fastest way.

where is this script located? in the robot?.

It’s in the robot’s character.

your gonna have to see if the closest torso changes in the for loop and then break from the loop to compute the new path.

-- in the for loop
local closestTorso =  -- the find nearest torso function 
if closestTorso.Position ~= targettorso.Position then 

Nope, it still happens, look at this;

I dont see what is the problem, i fixed your issue of it not going to the player and now it is?

I’ll create a new topic for this problem then.

1 Like