As the title reads, I want to make codes that last only a week. I also want to be able to control when they are released. For example, be able to “Preset” a Christmas code for Christmas. Is there any way of achieving this?
Well you could just manually add them to your system in a table, but if you don’t want that you can use os.date.
Your going to have to store the start date somehow, like in a data store. Then whenever the script runs such as on server startup, you grab that stored date and see if its been over a week. An alternative would be to store the one week date from your intended start date and see if the current date is less than or equal to that date.
but i dont know how to detect dates
Well using the link @CodedJack posted, os.time() tells you the exact current second so all you need to do is store this time. There are 604,800 seconds in a week so all you need to do is everytime the server starts, check if os.time() <= StoredTime + 604800 to determine if the codes are still active.