Hello! I have a question that I don’t believe I’ve found an answer to so far, so I was hoping that one of you could assist me with this.
I created an Application Center for a group that works perfectly, and I’ve been wondering about what I could do to make it better.
As of now, you can send in as many applications as you wish, but I only want to allow applicants to submit (at most) five applications per month. Is there any way that this could be done?
I’m sure you could create a DataStore to save how many applications somebody has submitted, but how can I allow for only a certain number per month, and then the value resets itself/goes back to 0? Thanks for the help!
The easiest way would be to store a timestamp of the last submitted application (using os.time() for example). Upon submitting a new application, check if the last one was submitted long enough ago that it meets your criteria.
If you want a system where one could submit 5 applications within any timeframe within the month, instead of only 1 per X days, that would get more complicated. You could still store the timestamps of all submitted applications and cycle through them upon submitting to count how many have been submitted in the current month.
Thank you! What you said about making multiple timestamps would be much easier than what I originally intended — allowing for submission within any timeframe of the month. Since months have an average of 30 days each, I could just put timestamps for every six days or so. If nobody else can find a somewhat simple way of allowing for five applications at any time in a month (for example, two in one day and three in another), then I will mark this as the solution. Thanks for the help!