Pathfinding getting stuck, therefore breaking pathfinding

Hi!
I’m making a random game with pathfinding, I’ve added a pathfinding Modifier into the baseplate, to prevent the NPC thing from going on it.

  1. What do you want to achieve? I’m just trying to get my NPC (red block thing, that is present in the video below) to pathfind to the destination, the first part of the video is the yellow block. Then I click on one of the coloured boxes, that sets the new destination.

  2. What is the issue? It works on pathfinding to the first part, but after it. For some reason it bugs out and just stops working, when it clearly works. Video here: Video

  3. What solutions have you tried so far? I’ve checked the dev forum, can’t find anything related to the problem. I have put more blocks surrounding the yellow box so that the NPC can pathfind all around it.

I’m very confused about why this is happening, as it works perfectly on the way there.
Any help would be greatly appreciated!

Are you setting the network owner of the NPC to nil? Issues often arise when the player is in control of objects trying to pathfind.

The script that controls the NPC is located in the NPC model & is in workspace. I’m unaware of the network owner, I can set it to nil? (or is it meant to be a different one)

It still does the same problem as before: Error

After a lot of testing, I have located the problem. You need to reset certain variables (as in each cycle they must be either 0 / nil in order to function.) If you having a similar issue, make sure to add this function, and call it before you call your main followPath (or equivalent) function, to reset.

local function reset()
	waypoints = nil
	nextWaypointIndex = 0
	reachedConnection = nil
	blockedConnection = nil
	
	return true
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.