Not sure why my Daily Quests system doesn't work?

I am working on a game that has multiple different things that operate on a 24 hour system (i.e., 24 hours after a player does [x], do [y]). Most of these just check when the player joins if it has been 24 hours since the last time they did [x].

However, the system I have in place seems very inconsistent, with many players reporting resets much sooner than 24 hours, though I am not sure how that is possible and cannot replicate it myself. Here is my current solution:

function playerDidSomething(player)
	local didSomethingTable[player] = {true, tick()+86400}
	--this table is saved to a datastore when the player leaves

function playerJoined(player)
	--first loads the table into didSomethingTable[player], then:
	if didSomethingTable[player][2] < tick() then
        didSomethingTable[player] = nil

Are you using


No, I am using tick() serverside. My understanding is that returns Unix tick in UTC?

Im not completly sure, but I would assume os.time would be more reliable if you are having these issue. IMO

I would use os.time() in this instance.

os.time() returns the amount of seconds that have elapsed since the last UNIX under UTC time.

If you save what os.time() returns when you award something, you can then check how many hours have passed since the saved value.

For example:

local data = -- Assuming you are loading a dictionary with the saved value from os.time() 
print((os.time()-data.SavedTime)/3600) -- This will give you the amount of hours that have elapsed since the saved time in the data dictionary

Hopes this gives you some ideas of what you can do to fix it.