Why is my Pathfinding sometimes placing 2 nodes?

I need help where when the NPC is following you it spawns in 2 nodes where then it makes the NPC slower and makes him look to the right and forward again.
Video:
https://gyazo.com/4024f2f151c0db83236aa09828c525a6
Code:

while wait() do
	if config.owner.Value ~= nil then
		local pathParams = {
			["AgentHeight"] = 6,
			["AgentRadius"] = 6,
			["AgentCanJump"] = true
		}
		local path = pathfindingService:CreatePath(pathParams)
		local playerCharacter = config.owner.Value.Character
		local distance1 = (NPC.PrimaryPart.Position - playerCharacter.PrimaryPart.Position).magnitude
		if playerCharacter and distance1 > 10 then
			path:ComputeAsync(NPC.HumanoidRootPart.Position, playerCharacter.PrimaryPart.Position)
			local waypoints = path:GetWaypoints()
			for _, waypoint in pairs(waypoints) do  
				local part = Instance.new("Part", workspace)
				part.Shape = Enum.PartType.Ball
				part.BrickColor = BrickColor.White()
				part.Material = Enum.Material.Neon
				part.CanCollide = false
				part.Anchored = true
				part.Size = Vector3.new(.5,.5,.5)
				part.Locked = true
				part.Position = waypoint.Position
				game:GetService("Debris"):AddItem(part, 1)
				
				if waypoint.Action == Enum.PathWaypointAction.Jump then
					NPC.Humanoid.Jump = true
				end
				NPC.Humanoid:MoveTo(waypoint.Position)
				while wait() do
					local distance = (NPC.PrimaryPart.Position - waypoint.Position).Magnitude
					local distance_from_player = (NPC.PrimaryPart.Position - playerCharacter.PrimaryPart.Position).Magnitude
					if distance < 5 then
						break
					end
					if distance_from_player < 10 then
						NPC.Humanoid:MoveTo((NPC.PrimaryPart.CFrame*CFrame.new(0,0,-3)).p)
						break
					end
				end
			end
		end
	end
end

Looking at the vid, I don’t think it is creating duplicate parts close together. It looks more like the NPC is recalculating the path and what you are seeing is parts from 2 different paths.

I recommend you check your AgentHeight and AgentRadius. Radius should be half the width and Height the literal height, both in studs of the NPC.

I still changed it but it still doing the same thing. It definitely looks like its creating multiple paths. I cant figure out how though.

Found the solution it was so simple lol. I needed to add NPC.Humanoid.MoveToFinished:Wait(2) anyways thanks for your help!