How do I get the NPC to find a new part?

I’m trying to make it so an NPC goes to each individual part laid out in a path. The problem is it can’t find a new closest part because the part that it’s on is always going to be the closest part to it so it just stops at the first part. How can I fix that?

local nodes = workspace.Nodes
local Closest
local hum = script.Parent.Humanoid
local torso = script.Parent.Torso
local PlayerPosition = torso.Position

for i,v in pairs(nodes:GetChildren()) do
	if Closest == nil then
		Closest = v
	else
		if (PlayerPosition - v.Position).magnitude < (Closest.Position - PlayerPosition).magnitude then
			Closest = v
			hum:MoveTo(Closest.Position)
		end
	end
end

You can store each of the nodes the AI has already been to and skip those, or you can change your for loop to a while loop and remove parts the AI has already been to from nodes

You could just store the last part in a variable then add in the script to check if the picked part doesn’t equal the last part otherwise it just continues on