Having PathfindingModifier in NPC confuses them

I created hitboxes in all my NPC’s so that the pathfinding system would avoid that space but when I placed a pathfinding modifier in the HumanoidRootPart, the NPC gets confused, thinking that it is inside the “Danger” cost.

When I remove the modifier, the pathfinding works as expected.


local pathParams = {
	AgentRadius = 3,
	AgentHeight = 5,
	AgentCanJump = false,
	AgentCanClimb = false,
	WaypointSpacing = math.huge,

	Costs = {
		Danger = math.huge,
	}
}
1 Like

I don’t know; maybe try using a large number, like 1e9, 9e9, etc. (probably not the solution)

Doesn’t math.huge return the largest number?

(Sorry for the late response.) Yes, but I’ve had a lot of problems that have been solved by just changing from math.huge to 1e9, etc.

I tried this but this didn’t change anything with the problem.