Pathfinding tries to pathfind through walls

Hello all! I’m trying to make characters move from one point to another using Roblox’s pathfinding service. The problem is that sometimes the path turns in unexpected ways and tries to walk through walls.

Here are some screenshots, with waypoints and nav vis shown:

Here’s my code (with irrelevant bits cut out):

local pathFinding = game:GetService("PathfindingService")
local path = pathFinding:CreatePath({AgentCanJump = false,AgentRadius = 2.5})

while true do
	wait(1)
	path:ComputeAsync(HumanoidRootPart.Position,Goal.Position)
	
	if path.Status ~= Enum.PathStatus.Success then continue end
	
	for _,waypoint in pairs(waypoints) do
		Humanoid:MoveTo(waypoint.Position)
		Humanoid.MoveToFinished:wait()
	end
end
2 Likes