Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make daily updating values?

So I've made a daily question in my game and after the player answers the question they will not be able to answer that question again until I manually reset the values. There is a bool value that changes to true after a player answers the question. If the bool value is already true the player will not be able to answer the question again. I would like to know if there is a way to change the bool value back to false once the player comes back the next day, or 23 hours. My game is filtering enabled and such. Does anyone know if this is possible? If so how?

1 comment

0

I'm using data stores and such to save the bool value. Just more information that might make my question make more sense (;

1 answer

✓ Accepted answer

You could potentially save a timestamp to the datastore when they answer the question, using os.time(), and compare the value to the current os.time() when they try to answer the question again. So:

local LoadedData = x --Lets say this is the timestamp that you loaded from the datastore (that was saved when they last answered the question)

local TimePeriod = os.time() -LoadedData --Will get the time gap between now, and them last answering the question

if (TimePeriod >= 86400) then --86400 being the number of seconds in a day
	--They can answer it
else
	--They can't :(
end

1 comment

0

Hmm... Yeah I never really thought of that. That definitely helps. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.