Im trying to make a Day/Night script with a while true do loop but it’s not working.
What im trying to do is if the ClockTime = 9 or < 19 then it adds 0.1 to the clocktime every 2 minutes, and if it’s bigger than 19 or smaller than 9 it takes 30 seconds to add 0.1 to the clock time but whenever the Clocktime is at 19 it stops.
I couldnt find anything on the internet about this issue.
Here’s my script:
local lighting = game:GetService("Lighting")
local starttime = 9
lighting.ClockTime = starttime
while true do
if lighting.ClockTime >= 9 and lighting.ClockTime <= 18 then
lighting.ClockTime = lighting.ClockTime + 0.1
wait(120)
elseif lighting.ClockTime >= 19 and lighting.ClockTime <= 9 then
lighting.ClockTime = lighting.ClockTime + 0.1
wait(30)
end
wait()
end```
What I think is happening is, when the script gets to the elseif line the loop stops, idk why its not working, and there are no errors in the output tab.