This script in sss switches ligthing effects per clock time hour, but the lighting effects, labeled by roman numerals for the hour they represent are not being enabled at the hour, how would i make the lighting effects be enabled when the clock hits the hour?
i only put 3 since the whole script is too long, but has all the hours
if game.Lighting.ClockTime == 0 then game.Lighting.O.Enabled = true end if game.Lighting.ClockTime == 01 then game.Lighting.I.Enabled = true game.Lighting.O.Enabled = false end wait(2) if game.Lighting.ClockTime == 02 then game.Lighting.II.Enabled = true game.Lighting.I.Enabled = false end
if you want the full new script, here it is:
while true do wait(2) if game.Lighting.ClockTime == 0 then game.Lighting.O.Enabled = true if game.Lighting.ClockTime == 01 then game.Lighting.I.Enabled = true game.Lighting.O.Enabled = false wait(2) if game.Lighting.ClockTime == 02 then game.Lighting.II.Enabled = true game.Lighting.I.Enabled = false wait(2) if game.Lighting.ClockTime == 03 then game.Lighting.III.Enabled = true game.Lighting.II.Enabled = false wait(2) if game.Lighting.ClockTime == 04 then game.Lighting.IV.Enabled = true game.Lighting.III.Enabled = false wait(2) if game.Lighting.ClockTime == 05 then game.Lighting.V.Enabled = true game.Lighting.IV.Enabled = false wait(2) if game.Lighting.ClockTime == 06 then game.Lighting.VI.Enabled = true game.Lighting.V.Enabled = false wait(2) if game.Lighting.ClockTime == 07 then game.Lighting.VII.Enabled = true game.Lighting.VI.Enabled = false wait(2) if game.Lighting.ClockTime == 08 then game.Lighting.VIII.Enabled = true game.Lighting.VII.Enabled = false wait(2) if game.Lighting.ClockTime == 09 then game.Lighting.IX.Enabled = true game.Lighting.VIII.Enabled = false wait(2) if game.Lighting.ClockTime == 10 then game.Lighting.X.Enabled = true game.Lighting.IX.Enabled = false wait(2) if game.Lighting.ClockTime == 11 then game.Lighting.XI.Enabled = true game.Lighting.X.Enabled = false wait(2) if game.Lighting.ClockTime == 12 then game.Lighting.XI.Enabled = false wait(2) if game.Lighting.ClockTime == 13 then game.Lighting.XI.Enabled = true wait(2) if game.Lighting.ClockTime == 14 then game.Lighting.XI.Enabled = false game.Lighting.X.Enabled = true wait(2) if game.Lighting.ClockTime == 15 then game.Lighting.X.Enabled = false game.Lighting.IX.Enabled = true wait(2) if game.Lighting.ClockTime == 16 then game.Lighting.IX.Enabled = false game.Lighting.VIII.Enabled = true wait(2) if game.Lighting.ClockTime == 17 then game.Lighting.VIII.Enabled = false game.Lighting.VII.Enabled = true wait(2) if game.Lighting.ClockTime == 18 then game.Lighting.VII.Enabled = false game.Lighting.VI.Enabled = true wait(2) if game.Lighting.ClockTime == 19 then game.Lighting.VI.Enabled = false game.Lighting.V.Enabled = true wait(2) if game.Lighting.ClockTime == 20 then game.Lighting.V.Enabled = false game.Lighting.IV.Enabled = true wait(2) if game.Lighting.ClockTime == 21 then game.Lighting.IV.Enabled = false game.Lighting.Enabled = true wait(2) if game.Lighting.ClockTime == 22 then game.Lighting.III.Enabled = false game.Lighting.II.Enabled = true wait(2) if game.Lighting.ClockTime == 23 then game.Lighting.II.Enabled = false game.Lighting.I.Enabled = true wait(2) if game.Lighting.ClockTime == 24 then game.Lighting.I.Enabled = false game.Lighting.O.Enabled = true wait(2) end end end end end end end end end end end end end end end end end end end end end end end end end end
In your loop you check if the time is an hour behind each time. In other words all the if statements are inside of each other. I fixed your code below for you but when you was making the if statements don't put them inside each other
Thanks @Gmorcad12345 for letting me know to turn the waits from 2 seconds to blank.
while true do wait() if game.Lighting.ClockTime == 0 then game.Lighting.O.Enabled = true end if game.Lighting.ClockTime == 01 then game.Lighting.I.Enabled = true game.Lighting.O.Enabled = false end wait() if game.Lighting.ClockTime == 02 then game.Lighting.II.Enabled = true game.Lighting.I.Enabled = false end wait() if game.Lighting.ClockTime == 03 then game.Lighting.III.Enabled = true game.Lighting.II.Enabled = false end wait() if game.Lighting.ClockTime == 04 then game.Lighting.IV.Enabled = true game.Lighting.III.Enabled = false end wait() if game.Lighting.ClockTime == 05 then game.Lighting.V.Enabled = true game.Lighting.IV.Enabled = false end wait() if game.Lighting.ClockTime == 06 then game.Lighting.VI.Enabled = true game.Lighting.V.Enabled = false end wait() if game.Lighting.ClockTime == 07 then game.Lighting.VII.Enabled = true game.Lighting.VI.Enabled = false end wait() if game.Lighting.ClockTime == 08 then game.Lighting.VIII.Enabled = true game.Lighting.VII.Enabled = false end wait() if game.Lighting.ClockTime == 09 then game.Lighting.IX.Enabled = true game.Lighting.VIII.Enabled = false end wait() if game.Lighting.ClockTime == 10 then game.Lighting.X.Enabled = true game.Lighting.IX.Enabled = false end wait() if game.Lighting.ClockTime == 11 then game.Lighting.XI.Enabled = true game.Lighting.X.Enabled = false end wait() if game.Lighting.ClockTime == 12 then game.Lighting.XI.Enabled = false end wait() if game.Lighting.ClockTime == 13 then game.Lighting.XI.Enabled = true end wait() if game.Lighting.ClockTime == 14 then game.Lighting.XI.Enabled = false game.Lighting.X.Enabled = true end wait() if game.Lighting.ClockTime == 15 then game.Lighting.X.Enabled = false game.Lighting.IX.Enabled = true end wait() if game.Lighting.ClockTime == 16 then game.Lighting.IX.Enabled = false game.Lighting.VIII.Enabled = true end wait() if game.Lighting.ClockTime == 17 then game.Lighting.VIII.Enabled = false game.Lighting.VII.Enabled = true end wait() if game.Lighting.ClockTime == 18 then game.Lighting.VII.Enabled = false game.Lighting.VI.Enabled = true end wait() if game.Lighting.ClockTime == 19 then game.Lighting.VI.Enabled = false game.Lighting.V.Enabled = true end wait() if game.Lighting.ClockTime == 20 then game.Lighting.V.Enabled = false game.Lighting.IV.Enabled = true end wait() if game.Lighting.ClockTime == 21 then game.Lighting.IV.Enabled = false game.Lighting.Enabled = true end wait() if game.Lighting.ClockTime == 22 then game.Lighting.III.Enabled = false game.Lighting.II.Enabled = true end wait() if game.Lighting.ClockTime == 23 then game.Lighting.II.Enabled = false game.Lighting.I.Enabled = true end wait() if game.Lighting.ClockTime == 24 then game.Lighting.I.Enabled = false game.Lighting.O.Enabled = true end end
Wanna know why the answers above don't work? They actually do, you just have to wait.
You put a wait(2)
in the while true do script....therefore, if the clock time is 14, it will take 14*2 seconds = 28 seconds for the lighting to be enabled.
Replace all the wait(2)
with just a wait()
and using Enzo's answer above, all should work well.
Maybe use an elseif statement along with a loop
while wait(1) do if game.Lighting.ClockTime == 0 then print("its 0 hour(s) into the day!") elseif game.Lighting.ClockTime == 1 then print("its 1 hour(s) into the day!") end end
and so on...