Date based actions?

Hello, I would like to create a script, which is based on dates, so if a player does an action, which takes a long time to complete (like a day), they don’t have to stay in the game and can leave, and next time they join (a day later) the timer is over, and the action is complete. Hopefully, this was understandable.
I also looked on google, but couldn’t find anything.

Thanks,
Gedeon

You can try using os.time for this, try reading here: os | Roblox Creator Documentation

1 Like

You can save the os.time() and then add 24 hours in seconds and see if the os.time() is over 24 hours in seconds and if it is let them do the action again.

os.time is unreliable as it returns different values for different servers in different locations. I’ve never done it but i would try new Memory Store. Use sorted maps SetAsync and give Player.UserId as a key, value is not important and give expiration duration for third parameter. To check time is over or not try GetAsync and pass player.UserId as a key again. If it returns a value, it is not expired, otherwise it has expired.

yes i actually asked this question way ahead of the time i need it, but yes i will come back here when it is, and will mark the solution to this.