Hello all!
im play in lobby, got reward, give only 3 hours, rejoin game again got reward after closed game, what is save time no working :/ No know how to save the time left after closing, can fix? :3 - (when close game,to need time saved)
wait(10800) -- it 3 hours = 10800 seconds
currency = "Money"
moneyboost = 25000
debounce = false
function onTouch(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
local ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
ThisPlayer.leaderstats:findFirstChild(currency).Value = ThisPlayer.leaderstats:findFirstChild(currency).Value + moneyboost
if ThisPlayer.leaderstats:findFirstChild(currency).Value then
game.Workspace.DailyReward.Parts.Gui.CustomPlayerTag.PlayerName.Text = "You were awarded!"
end
debounce = true
wait(10800)
game.Workspace.DailyReward.Parts.Gui.CustomPlayerTag.PlayerName.Text = "Daily Reward"
debounce = false
end
end
end
script.Parent.Touched:connect(onTouch)

5 comments
nice answer, but consider not using anonymous values in your code, it's for code maintainability, and helps someone predict what the code does before even reading it.. but great answer :)
Uh? This doesn't matter... at all, in fact, most representation of DataStore codes use undeclared variables. This is advanced programming.
i mean, when someone sees
PreviousTimeStamped/3600it's not immediately clear of what this is for, any professional programmer will tell you not to use anonymous valuesfor simple applications, its fine, but for production, its not. trust me, i've been in situations where there's many anonymous values to quickly comprehend the code
Well, there is only one, so don't be so pressed about it