Automatic on / off street light script

What u need for my post:

What u could try using is CollectionService, in cases that a normal for loop doesn’t work, collectionService will solve that issue, which in this case helped me greatly.

I will share my code so u will understand what to do.

local Lighting = game:GetService("Lighting")
local CollectionService = game:GetService("CollectionService")

for _, Lights in CollectionService:GetTagged("Lights") do
	local PointLight = Lights:FindFirstChildWhichIsA("PointLight")
	
	Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
		if Lighting:GetMinutesAfterMidnight() > 6*60 then
			Lights.Material = Enum.Material.Plastic
			PointLight.Enabled = false
		end
		if Lighting:GetMinutesAfterMidnight() > 18*60 then
			Lights.Material = Enum.Material.Neon
			Lights.Transparency = .2
			PointLight.Enabled = true
		end
	end)
end

U can always consider adding TweenService for a smooth transition between enabled/disabling the street light posts.