You have to make the AgentRadius smaller than 2, otherwise the NPC will refuse to go to it’s goal, in this case, the player. It seems that if the gap is not exactly 6 studs wide, the NPC will not traverse it. The stairs and catwalk are both 6 & 7 studs wide, respectfully.
EDIT
After doing a little bit of testing, it seems that this is due to a very skinny part being in the way of the pathfinding, instead of the pathfinding service going “between” the two walls in the repro file, they want to go into the corner for some reason. The NPC should always go directly in the middle instead of trying to cut the corner.
The repro place is not using the ImprovedSearch on pathfinding, (which for the most part fixes the corner issue in many cases). However, when testing with both ImprovedSearch on and off the path status returns “NoPath”, this is because the diameter of the Navmesh in the doorway is only 2 studs wide. As your agent radius is 2 the diameter of the agent is 4 studs thus he doesn’t fit, your agent radius must be 1 stud if you want him to pass within this small gap. It is more so that the Navmesh generation is quite poor, but this is the case with many things, especially stair cases.
Your code is very outdated and is running very slow.
First you need to set up improved search under workspace properties.
Then you have to change agent radius to 1 for it to work(Radius is half of the diameter) and works on your npc.
here is a better code:
--Import the module so you can start using it
local ServerStorage = game:GetService("ServerStorage")
local SimplePath = game:GetService("PathfindingService")
--Define npc
local Dummy = script.Parent
-- Define a part called "Goal"
local Goal = workspace.Goal
local AgentParameters = {
AgentRadius = 1,
AgentHeight = 5,
AgentCanJump = false,
AgentCanClimb = true,
}
--Create a new Path using the Dummy
local Path = SimplePath:CreatePath(AgentParameters)
function moveTo()
Path:ComputeAsync(Dummy.HumanoidRootPart.Position, Goal.Position)
if Path.Status ~= Enum.PathStatus.NoPath then
if #Path:GetWaypoints() >= 3 then
Dummy.Humanoid:MoveTo(Path:GetWaypoints()[3].Position)
end
end
end
while task.wait() do
moveTo()
end