I know how to make a timer that continues to tick down after the player left the game using AlvinBlox’s Daily Reward tutorial. However, I had some issues implementing a feature that would allow me to store multiple timers.
I don’t know if anyone has played Pet Simulator X. If you have then you probably used the “Dark Matter Machine” to convert rainbow pets. Thats basically what I’m trying to do here. I’m trying to store multiple items with each of them having a different amount of time.
I also am curious on how I would know if one of them finished so I can trigger an event to the client!
You can probably save multiple timers in a dictionary using datastore if that makes sense. Assuming that the method of saving the starting time is based on time passed since unix epoch.
For example:
local timers = {
thisItem = 1704304034 -- os.time()
thisOtherItem = 1704300034
} -- this dictionary is saved in datastore.
print(os.time() - timers.thisItem) -- (CurrentTimeStamp - PreviousTimeStamp) = 65 seconds ago