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.
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.