How to make a daily system?

Hey everyone.

I’m just looking to make a Daily Challenges / Daily Rewards system.

I’m not sure how to check if the day is over, to then give a new challenge/reward

Thanks in advance!!

1 Like

DateTime,
tick() might also work but I think tick is based on the client’s time so people might be able to just change it

3 Likes

Tick() provides the time in seconds that has passed since 1st of January of 1970.

local CurrentTime = tick() --Capture the current time.

wait(60) --Waiting 60 seconds to simulate time passing.

if tick() - CurrentTime >= 60 then --Captures the current time again and compares it to the old time. Checks if 60 seconds passed.
	print("60 seconds have passed since last capture!") 
	--Code you want to execute after time passed.
end

You could use this together with a DataStore to check how much time has passed since last join.
Saving the “CurrentTime” in a DataStore and checking it whenever a user joins would give you what you’re trying to achieve.

2 Likes
local Timer = --Time till next Reward
local CurrentTime = tick() 
wait(Timer)

if tick() - CurrentTime >= Timer then 
	--Reward here
end
2 Likes

tbh i just do a

wait(86400) --aka a day
1 Like

Please actually try to help the original poster :joy:

1 Like

Could you not alter my code without mention next time :pensive:

Yep got it working, thanks for your reply!

1 Like