Pathfinding NPC to player shows: Enum.PathStatus.NoPath when I jump!

Hello. My problem is whenever I jump the NPC loses the path, I reckon this is something to do with height obviously but I don’t know how to fix it i’ve tried to brainstorm to no avail!

Here’s a gif (the NPC get’s stuck because no path obviously)

Whenever I jump the NPC stutters because the path is lost. (tried it with ROBLOX’s wiki pathfinding and with my own).
What I think is to check if the waypoints exist when it’s lost and move the humanoid to the last waypoint.
I don’t know if it’s the solution though. help please

		local success, errorMessage = pcall(function()
			path:ComputeAsync(Root.CFrame.Position, position) -- position is character's HRP position, and root is the NPC
		end)
		if not success or path.Status ~= Enum.PathStatus.Success then
			print(path.Status) -- the print
			return 
		end
		local waypoints = path:GetWaypoints()

		if path and waypoints or checkw(waypoints) then
			if checkw(waypoints) ~= nil and checkw(waypoints).Action == Enum.PathWaypointAction.Walk then
				Humanoid:MoveTo( checkw(waypoints).Position )
				Humanoid.Jump = false
			end
 		end

I think you’re currently telling the NPC to go to the current character’s position. Instead of grabbing the exact location, just get both the X and Z character’s axis and then change the Y to equal the NPC’s Y axis so it might look like this:

Vector3.new(HumanoidRootPart.Position.X, NPC.HumanoidRootPart.Position.Y, HumanoidRootPart.Position.Z)
1 Like

This is what I was looking for just didn’t know where to put it. Nice, but do you know how to explain to me why it didn’t find a path if I was elevated compared to the NPC?

This might be wrong, but I think it’s because the NPC only travels through the NavigationMesh and if you jump you’re getting out of it.

2 Likes

That totally makes sense I didn’t think of NavigationMesh as a 2D space!