Waypoint After a PathfindingLink Is Too Far Apart

I am currently computing a static path for an NPC before I move onto player chasing. I am also experimenting with pathfindinglinks to allow the NPC to use ladders and various other objects.

The current issue at hand is that the next waypoint after the end attachment of the pathfinding link has a much larger gap than other waypoints. This gap increases even further if I were to lengthen the walkway more. You can view the gap here in this video.

The reason this is unwanted is that the MoveTo function has an 8-second “reached” timer. If the NPC does not reach that far waypoint within those 8 seconds it will time out and will have to recompute a path. You can view the setup of the pathfinding link here. The bottom square is the starting attachment for the link and the top square is the end attachment.

I can not seem to figure out what in my code causes this issue, but I would like a fix so that the next waypoint after the pathfindinglink matches the distance interval of the rest.

Below is the function that moves the NPC’s humanoid to each waypoint:

local path:Path = computePath(startGoal, endGoal)
	
	local waypoints = path:GetWaypoints()
	local currentWaypointIndex = 2 -- Starting point is 2, 1 is the current position of the root
	
	local moveToFinishedConnection:RBXScriptConnection
	
	moveToFinishedConnection = humanoid.MoveToFinished:Connect(function(reached)
		if reached then
			print("Finished")
			if currentWaypointIndex < #waypoints then -- Move to the next waypoint
				currentWaypointIndex += 1
				print("Walking to waypoint #"..currentWaypointIndex)
				humanoid:MoveTo(waypoints[currentWaypointIndex].Position)
				if waypoints[currentWaypointIndex].Action == Enum.PathWaypointAction.Jump then
					humanoid.Jump = true
				end
			else -- Reached the final waypoint
				print("Path reached!")
				moveToFinishedConnection:Disconnect() -- To avoid memory leaks
			end
		else -- Failed to reach waypoint, recompute the path
			moveToFinishedConnection:Disconnect()
			walkHumanoid(root.Position, endGoal)
		end
	end)
	
	-- Visualize the path
	for _, point:PathWaypoint in ipairs(waypoints) do
		local part = Instance.new("Part")
		part.Anchored = true
		part.CanCollide = false
		part.Material = Enum.Material.Neon
		part.Color = Color3.fromRGB(255, 255, 255)
		part.Size = Vector3.new(1, 1, 1)
		part.Position = point.Position
		part.Parent = workspace
	end
	
	-- Move the humanoid
	humanoid:MoveTo(waypoints[currentWaypointIndex].Position)
	if waypoints[currentWaypointIndex].Action == Enum.PathWaypointAction.Jump then
		humanoid.Jump = true
	end

The settings for path creation are (Ladder is the label associated with the pathfindinglink which is why it’s given high priority):

local height = 5
local radius = 3
local canJump = true
local costs = {
	Ladder = 1
}