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.
