Pathfinding won't jump and tries to go through walls

Hi developers,

I have a problem where a zombie I made will try to go through walls and can’t jump over them, even though AgentCanJump is set to true.
Here’s the script I’m using: (I shortened it so it’s easier to read)

while wait(1) do
		nearestPlayer = getClosestPlayer() -- The closest player's HumanoidRootPart
		if nearestPlayer ~= nil then
			path = pathService:CreatePath({AgentHeight = 2.1, AgentCanJump = true})
			path:ComputeAsync(script.Parent.HumanoidRootPart.Position, nearestPlayer.Position)
			waypoints = path:GetWaypoints()
			for _, i in pairs(waypoints) do
				script.Parent.Humanoid:MoveTo(i.Position)
			end
		end
	end

You forgot to wait until you get to the next waypoint. Under script.Parent.Humanoid:MoveTo(i.Position), add script.Parent.Humanoid.MoveToFinished:Wait().

It instantly decides to go to the last waypoint which should be the target, making it no different than calling MoveTo with the position itself.

I can’t believe I forgot about that! Doesn’t MoveToFinished wait until it reached the final target area though?

Edit: Nevermind, I’m stupid.

I did that, but it still seems to try to go through the wall…

(The parts represent the path)
why

I don’t exactly remember how that was done, but waypoints had some property telling the NPC to jump. You will need to check that.

Edit: There is waypoint.Action which can be equal to Enum.PathWaypointAction.Jump. You should do script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) if the action is Jump.

I suddenly realise that AgentCanJump will let it go through short enough walls…
And that you have to make it jump.
I make myself look dumber every post…