So I'm working off of roblox wiki, and am trying to make the day + night system and a street light that turns off according to the day.
I am new to coding, but wanted to try doing it slightly differently from them, and here's what I got:
script for day / night, inside workspace:
minutesAfterMidnight = 0
while true do
minutesAfterMidnight = minutesAfterMidnight + 3
game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
wait(.1)
end
now this is working fine, but my Streetlight doesn't work properly.
here is streetlight script:
if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then
script.Parent.LightBulb.SpotLight.Enabled = false
end
if game.Lighting:GetMinutesAfterMidnight() == 18 * 60 then
script.Parent.LightBulb.SpotLight.Enabled = true
end
the light only flickers off for about 2 seconds and closer to the night then the morning.
Hope you can help and thank you for your time.

2 comments
is the streetlight script in a loop? or Lighting.Changed function?
No that's the whole script.