Hey guys!
So I want a building to change the materials for it's windows according to the time and for some reason this doesn't work. Help?
Code:
local light = script.Parent.Model:GetChildren()
for i = 1, #light do
wait(0.1)
if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
light[i].Material = Enum.Material.Plastic
end
if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 then
light[i].Material = Enum.Material.Neon
end
end

2 comments
Try droppin a line between the L and end. Might be the issue, or its because Model or Enum is in capitals, Reply back if this helps!
What is the length of light variable? if it is equal to 1, then the loop wont run