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!!
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!!
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
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.
local Timer = --Time till next Reward
local CurrentTime = tick()
wait(Timer)
if tick() - CurrentTime >= Timer then
--Reward here
end
tbh i just do a
wait(86400) --aka a day
Please actually try to help the original poster
Could you not alter my code without mention next time
Yep got it working, thanks for your reply!