I need to make a day/night cycle with a working digital clock displayed at the bottom of a player’s screen. 8 minute day, 2 minute night. Also with days of the week. Please reply if you know how to script this!
It's more difficult if you want the digital clock's numbers to be images, but if you can find a font you like, it's easier. What you'll need to do:
workspace.DistributedGameTime
and perform % (secondsInDay)
to get the current time-of-day in seconds -- secondsInDay = (8 + 2) * 60 -- or 600
.
wait()
or faster if you want to use the RunService).math.floor(153/60) == 2
and 153 % 60 == 33
. You can then combine the two numbers, ex using string.format("%s:%s", minutes, seconds)
to get 2:33
.workspace.DistributedGameTime
, you'll need to use a RemoteFunction to ask for the time (possibly only once, depending on how you advance the time on the server). You will need to keep the value up-to-date on the local script (which is easy if it's progressing in real time as you can just base it off of tick()
.)