local DataStore = game:GetService("DataStoreService"):GetDataStore("LastLogin") game.Players.PlayerAdded:connect(function(Player) wait() local LastLogin = DataStore:GetAsync(Player.userId) if LastLogin then local Seconds = os.time()-LastLogin local Minutes = Seconds/60 local Hours = Minutes/60 print("It has been: "..Hours.." hours Since your last reward") if Hours >= 24 then print("You get a daily login award") DataStore:SetAsync(Player.userId,os.time()) end else DataStore:SetAsync(Player.userId,os.time()) end end)
I put this code on a server script in the workspace, but this only works with local time. I know this because i changed my date 1 day forward and it printed that i got an award and last reward was 24h ago.
I want to use server time for this, i think it's based off PST but whatever, as long as its not possible to loophole.
It's adjusted for GMT, but it assumes that the system clock is actually the right time for its timezone. If the clock has the wrong time for the timezone, as my computer sometimes does, it will display the wrong time - It adjusts for the wrong time in the right timezone.
Just make sure that you do it on the server, and so long as the server has the correct time then it will always be right.
Is this run on studio? I believe it simply adjusts for timezone, so if you change what day it is then that will change - I believe that the servers are guaranteed to have the correct time, though (although different timezones)