So I’m trying to create a server wide countdown. I know It’s possible by using like a for loop or something but I want it across every server in the game. There is this game I play that has this feature, and it counts down from 20 minutes…every twenty minutes across ALL servers, not just one. So if you server-hopped, the timer would be the same, even if the servers were created at a different time. However, I have no clue how to do this. Would tick() be useful? Or would os.time() be useful which I have never even used before and don’t know what it does.
This keeps track of the time based on UTC time. Therefore, if you were to make a timer with it, it would be able to be extremely accurate with the times as it’s grabbing time from a timezone and not a server. So yes, this is the best solution that I know of.
If you want to be able to trigger an event in-game that will start a timer you can use MessagingService. This will allow you to transfer real-time information [sub-1-second]. Using this you can communicate time-remaining, or just that a timer started. [I say communicate time-remaining because in some cases a server will start after the timer is started, and that game will need to know the time remaining]
If you want to go the simple route of having predefined times, you can use some sort of while loop to keep track of time remaining until a certain date. If you’ve got any other questions, let me know.
I don’t necessarily want it to be an event, just something that runs constantly. I’ll think I’ll be using os.date(). But one problem is making the time in seconds go down, not up. And also making it count down from 20 minutes each time, not 60 by using the os.date().min key.