How to make a one day game pass that last 24 hours

How to make a one day game pass that last 24 hours.

1 Like

You need to utilize developer products and os.clock() or something that measures its starting time and then calculating its time passed, using the starting time. Starting time needs to be saved between sessions.

2 Likes

How would they save the sessions I just need an example of what to use.

1 Like

When the player buys the gamepass the script should call os.time() and add 86400 to it, then save that number in a datastore. The next time the player joins the game, fetch that number and compare it to the current time. If the stored time is less than the current time, then it means the gamepass has expired.

3 Likes

Just to be a bit exact for if you want to change the number depending on the amount of days.

1 day = 86400 seconds
2 days = 172800 seconds
1 week = 604800 seconds

1 Like