PathfindingService:ComputeAsync() fails for seemingly no reason

image
This is a screenshot from my game. I added a red ball here to indicate where I want the pictured dummy to pathfind towards. But as you might’ve expected, it doesn’t, and the failsafe :SetPrimaryPartCFrame() is what moves them instead. But as you can see, there are no obstructions in the path. It’s just an empty room right now.

I’ve tried using different positions, using pathfinding modifiers, and nothing led me to a solution.

function walkTo(position)
	local path = PathfindingService:CreatePath();
	path:ComputeAsync(char.HumanoidRootPart.Position, position);
	local waypoints = path:GetWaypoints();
	print(#waypoints); --Without fail, this always prints 0.

	for _, waypoint in next, waypoints do
		if path.Status == Enum.PathStatus.Success then
			hum:MoveTo(waypoint.Position);
			hum.MoveToFinished:Wait(10);
		else
			warn("Pathfinding error");
			break;
		end
	end
end
2 Likes

Try printing path.Status, what does that output?

1 Like