I’m creating a simulator, and I don’t know how to make the chest open every 5 hours for each player.
I’ve tried but it only works out for one player.
May you please provide the code you have already written?
If you are making a simple daily reward system, you would need to store the last time the player collected the daily reward chest on the server. Make sure this saves. Whenever this daily reward chest is touched, you would check if os.time() - the last time they collected the daily reward chest is greater than or equal to 5 hours (18000 seconds). If so, then you can reward them and set the last time they received the daily reward to the current time.
Try doing it client-side via a local script and using a remote event to send data via a script.
yes this
currency = “Diamonds”
amnt = 50000
debounce = false
function onTouch(hit)
if hit.Parent:findFirstChild(“Humanoid”) ~= nil and debounce == false then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
ThisPlayer.leaderstats:findFirstChild(currency).Value = ThisPlayer.leaderstats:findFirstChild(currency).Value + amnt
script.Parent.Transparency = 0
script.Parent.CanCollide = false
debounce = true
wait(1800)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
debounce = false
end
end
end
script.Parent.Touched:connect(onTouch)