[PATHFINDING] How to move humanoid to next checkpoint once it reaches a certain range of current checkpoint

All in the title. Once it reaches a certain range of a checkpoint, I want the humanoid to move to the next checkpoint.

local Waypoints = Path:GetWaypoints()
for i, v in pairs(Waypoints) do
	if not Cancel then
		NPC_Humanoid:MoveTo(v.Position)
		if v.Action == Enum.PathWaypointAction.Jump then
			NPC_Humanoid.Jump = true
		end
		NPC_Humanoid.MoveToFinished:Wait()
		if not game.Workspace:FindFirstChild("PickupGun") then
			Cancel = true
		end
	end
end