How would I go about making a daily reward chest?

Hello, I am currently trying to make a daily reward chest, I would like it to grant you 150 coins upon touch, you would walk onto the yellow pads and it would add to your currency.

Here is the script I have made for the money leaderstats, it all works fine so far I haven’t found any bugs in it.
image

Here is the reward chest.
image

I am not a scripter so I have no idea how I would make this, I haven’t seemed to find a tutorial based on what I’m looking for, most have just been GUI’s, if you could share some posts it would be greatly appreciated!

Incase you would like to share a script with me, my discord is, RealTimeChicken#3718

Thanks!!

Use DataStore to determine if or when the player has collected a reward. If they were not rewarded within the last 24 hours (check with the Datastore) then you can give them the reward.

1 Like

Are you client-sidedly checking if the player touches the chest? You can just do this all on the server without the need of events (unless you’re using UI, then it would be acceptable)

Also, this video by @Alvin_Blox could be of some use to you:

1 Like

See this is what I have seen before but is not what I’m looking for.

try adding a local script in starter gui

have variables for player, event, leaderstats, or coin value

then make touch event in local script
like:

game.Workspace.CoinGiver.touched:Connect(function()
– here fire the event
end)

server script:

… OnServerEvent:Connect(function()
Money.Value = Money.Value + 150 – amount u wanna add to player balance
end)

modify more to add only daily like only once every 24 hours (daily)

edit: image

player.leaderstats.Money.Value = player.leaderstats.Money.Value + 150

You probably don’t want to do this, because it will not save since the server does not see the changes.

Also, this thread is over half a year old, so the OP probably solved the issue already. It’s wise to not reply to a question thread if it hasn’t been active for over 3 or so months.

So there are a lot of ways to make this, I’m using this method:

When the Player Redeems the Chest you add to the current os.time() in how many seconds you want your Player to be able to Redeem the Chest again.
After that you just save the Next Redeem Time and that’s it.

1 Like

he posted this almost a year ago, small chances that he still wants it

Yea just realised.
Idk maybe if someone will need help again in future it’s good to have it here.

6 Likes

if your going to leave the giveCurrency remote make sure to secure it so players cant give them self money

It’s best to handle this server-side. You can create a treasure chest and check for each player the last time since they joined the game from their savedData which will allow you to calculate if a whole day passed or not. You can then add the reward from the chest to the player after they touch the chest and you can fire a remoteEvent to that client and do all the fun gui stuff over there.

Just use os.time to check if the player has gotten it yet and wait the 24 hours.