Help with a AI Car

The code:

local amountOfRoad = 3
local NPC = script.Parent.NPC

while true do 
	for i = 1, amountOfRoad do
		local part = script.Parent["D" .. i]
		if part.BrickColor == BrickColor.new(248, 248, 248) then
			NPC.Humanoid:MoveTo(part.Position)
			NPC.Humanoid.MoveToFinished:wait()
		elseif part.BrickColor == BrickColor.new(255, 0, 0) then
			local intersection = workspace["Intersection" .. i]
			print(intersection.Name)
			if intersection.Right.Interactive.State.Value == "red" then
				
			else
				NPC.Humanoid:MoveTo(part.Position) 
				NPC.Humanoid.MoveToFinished:wait()
				wait(0.01)
			end
		end
	end
end

D1 is the spawn for the car.
D2 is right infront the intersection (the stop point)
D3 is after the intersection (when the light is green)

robloxapp-20231209-0839276.wmv (1.8 MB)

As you see in the video: The car is bouncing back and forth to D1 and D2 while the traffic light is blocked. Which is not what it is supposed to do.

The car is supposed to wait at D2 for D3 to be clear/the traffic light to be green.

THANKS FOR THE HELP