So basically i want to recreate a day/night countdown timer like in scp-3008. Like in 5 minutes theres gonna be night, after it changes to night, u have to wait another 5 mins to switch it back to day. Anyone knows how to make this?
4 Likes
wait(300)
Your welcome…
(That was a joke)
local timeb = 300
for time = 1, 300 do
timeb = timeb +1
end
I’m pretty sure you play with numbers to make it every x seconds (in game) add x seconds to the game.Lighting.TimeOfDay
This won’t work since the loop will complete basically instantly, and timeb does nothing.
2 Likes
You could use tick()
or os.time()
for it, they are very useful.
os.time()
Tick()
Examples
tick()
local current_time = tick()
task.Wait(300) -- 300 seconds = 5 minutes
print(tick()-current_time) -- would print 300
1 Like
local timeb = 300
for time = 1, 300 do
timeb = timeb + 1
wait(1)
end
Use ‘task.wait’ not ‘wait’. ‘task.wait’ is more dependable than ‘wait’.
1 Like
I don’t know, I used it and it broke stuff and used ‘wait’ and worked normally it’s based on what code you’re at.
Make a script and place this inside, you can change up the code.
local countdown = 300
local day = true
while count ~= 0 do
count -= 1
wait(1)
end
if day then
game.Lighting.ClockTime = 4 --Can change this for the time of Night you like.
else
game.Lighting.ClockTime = 14 --Can change this for the time of Day you like.
end
Haven’t tested so let me know if this works or not.
1 Like