How do you make a daily reward system. (Everyday it gives you 'x' amount of game currency)
You can save the the time since their last login in the datastore. See how much time has passed since his last login. This is just some help. Try to learn.. read.. this is just to help you getting started.
local DataStore = game:GetService("DataStoreService"):GetDataStore("LastLogin") --Get the DataStore. 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") --This just prints how much time has passed since your last reward. if Hours >= 24 then print("You get a daily login award") --This happens if 24 hours has passed since his last login so he gets an award! DataStore:SetAsync(Player.userId,os.time()) end else DataStore:SetAsync(Player.userId,os.time()) end end)
I have tried something for my old game but I am not sure if it works. In case you want to add daily cash.
local Humanoid = script.Parent.Humanoid function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value:findFirstChild("leaderstats") if Leaderstats ~= nil then Leaderstats.Cash.Value = Leaderstats.Cash.Value + 250 wait ( ) -- type in the parenthesis the seconds of a day cause I am bored to estimate now xD and do this a bunch of time, but each times you can change the cash value that is being given. Tell me if it worked.