Why is this not working? :C

local time = game.Lighting.ClockTime

–settings
local cycle = true

local daytime = 10 --time
local daylong = 10 --seconds

local nighttime = 23 --time
local nightlong = 10 --seconds

game.Lighting.ClockTime = daytime
while true do
wait (daylong)
repeat
game.Lighting.ClockTime += 0.001
wait (0.1)
until time == nighttime
wait (nightlong)
repeat
game.Lighting.ClockTime += 0.001
wait (0.1)
until time == daytime
end

2 Likes

Is it you exact copy of your not working script? One line of code should be commented and it’s not commented:

local time = game.Lighting.ClockTime

–settings -- Not commented
local cycle = true

local daytime = 10 --time
local daylong = 10 --seconds

local nighttime = 23 --time
local nightlong = 10 --seconds

game.Lighting.ClockTime = daytime
while true do
wait (daylong)
repeat
game.Lighting.ClockTime += 0.001
wait (0.1)
until time == nighttime
wait (nightlong)
repeat
game.Lighting.ClockTime += 0.001
wait (0.1)
until time == daytime
end

Probably you just incorrectly copied the script here and your script is slightly different.

The script itself does work, your problem is with changing the ClockTime by just 0.001
By just adding 0.001 it’s basically going at real time, so the ClockTime goes up by 1 minute every 60 seconds.

If you only want the day/night cycle to last 10 seconds each then you will need to adjust the 0.001 to about 0.15

2 Likes

OH THANKS! i am such silly lol, the time moved so slow so i didnt notice that when testing xD

1 Like

i did comment it but some how one of the - is gone :rofl: