On this page
A daily rewards script saves the time of each player's last claim on the server, lets them claim again once 24 hours have passed, and counts a login streak that resets if they stay away for more than 48 hours. Rewards grow each day up to a big day 7, then the cycle repeats. The server decides everything with its own clock, so changing the time on a phone or PC gets a player nothing.
The rules of a daily reward streak
Each claim stores two numbers: when it happened and how long the streak is. When a player asks to claim, the server compares the current time with their last claim:
| Time since the last claim | What happens |
|---|---|
| Less than 24 hours | No reward yet, and the popup shows a countdown |
| 24 to 48 hours | The next day's reward, and the streak grows by one |
| More than 48 hours | The streak resets and they get the day 1 reward |
| Never claimed | Day 1 is ready straight away |
So after every claim, a player has a 24-hour window to come back and keep the streak going. Someone who claims at 6 pm on Monday can claim again from 6 pm on Tuesday. If they are back before 6 pm on Wednesday, the streak grows; any later and it starts again at day 1.
This guide uses a rolling 24 hours instead of a reset at midnight. Midnight is a different moment for every player on Earth, while "24 hours since your last claim" means the same thing for everyone.
Choose rewards worth a streak
The rewards sit in a list of seven, one per day, and day 8 starts the list again. The version in this guide pays coins:
| Day | Coins | Why |
|---|---|---|
| 1 | 50 | Small, but it shows a new player the system works |
| 2 to 6 | 75, 100, 150, 200, 300 | A little more each day, so every return feels better |
| 7 | 1000 | More than the first six days together, the reason to finish the week |
Coins are the easiest reward to start with, but day 7 is a good spot for something players can't simply buy: a crate, a pet, a title or a trail. Keep the totals in line with the rest of your economy, so a week of claims gives players a boost without replacing play.
Save the last claim and the streak
Both numbers have to survive leaving and rejoining, so they belong in the player's saved data. This guide builds on the PlayerData module from the DataStore tutorial, which loads one table per player, saves it with retries and gives other scripts PlayerData.Get and PlayerData.WaitFor. Add two fields to its TEMPLATE:
-- PlayerData ModuleScript in ServerScriptService: TEMPLATE with the two daily reward fields added
local TEMPLATE = {
Coins = 0,
Wins = 0,
PlayMinutes = 0,
Inventory = {},
LastClaim = 0, -- os.time() of the last claim, 0 means never
Streak = 0, -- claims in a row
}LastClaim holds the result of os.time() on the server: the number of seconds since January 1, 1970, in UTC. That number means the same moment on every Roblox server in every country, so it is safe to compare across sessions and servers. Players with older saves don't have these fields yet, and the module's template merge fills them in with the defaults, so no save needs a reset.
If you save data some other way, all this guide needs is a saved table per player with those two numbers in it.
Write the server script
Add a Script to ServerScriptService and name it DailyRewards.
-- Script in ServerScriptService (DailyRewards), part 1: the streak rules, on the server's clock
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local PlayerData = require(ServerScriptService:WaitForChild("PlayerData"))
local DAY = 24 * 60 * 60 -- seconds in a day (use 60 while testing)
local REWARDS = { 50, 75, 100, 150, 200, 300, 1000 } -- coins for days 1 to 7, then it loops
local claimRemote = Instance.new("RemoteFunction")
claimRemote.Name = "ClaimDailyReward"
claimRemote.Parent = ReplicatedStorage
-- Where a player stands right now
local function getStatus(data)
local elapsed = os.time() - data.LastClaim
local streak = if elapsed > 2 * DAY then 0 else data.Streak -- away too long: back to day 1
local day = streak % #REWARDS + 1
return {
Ready = elapsed >= DAY,
Streak = streak,
Day = day,
Reward = REWARDS[day],
NextClaim = data.LastClaim + DAY,
}
end
-- Sends the status to the player's screen as attributes
local function sendStatus(player, data)
local status = getStatus(data)
player:SetAttribute("DailyDay", status.Day)
player:SetAttribute("DailyReward", status.Reward)
player:SetAttribute("DailyNextClaim", status.NextClaim)
end
local function onPlayerAdded(player)
local data = PlayerData.WaitFor(player)
if data then
sendStatus(player, data)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAdded, player)
endgetStatus is the whole rulebook. elapsed is the time since the last claim by the server's clock, and more than two days drops the streak to 0, so the next claim is day 1 again. streak % #REWARDS + 1 turns any streak into a day from 1 to 7: a streak of 6 claims day 7 next, and a streak of 7 starts over at day 1. NextClaim is the exact second the next reward becomes available.
sendStatus puts the day, the reward and NextClaim on the player as attributes. Attributes the server sets on a player replicate to their client, which is how the popup knows what to show. PlayerData.WaitFor holds this back until the player's data has loaded, so the first status is never based on missing data.
Claim the reward with a RemoteFunction
The client asks, the server decides. Paste this at the bottom of the same script:
-- DailyRewards Script, part 2: the claim, decided on the server (paste below part 1)
claimRemote.OnServerInvoke = function(player)
local data = PlayerData.Get(player)
if not data then
return false -- data still loading
end
local status = getStatus(data)
if not status.Ready then
sendStatus(player, data) -- too early: resend the real countdown
return false
end
player.leaderstats.Coins.Value += status.Reward
data.LastClaim = os.time()
data.Streak = status.Streak + 1
sendStatus(player, data)
return true, status.Reward
endThe remote takes no arguments, and that is the point. The client never says which day it is, how long it waited or how much it should get. The server reads its own clock, checks the rules and either refuses or pays out, stores the new LastClaim and Streak in the player's table and sends the new status back.
Spamming the remote gets nothing either. Nothing in the function waits between the check and the write, so two calls can never both pass the check: the first claims, and the second sees a fresh LastClaim and gets false.
The coins go through leaderstats, and the PlayerData module copies them into the saved table. Swap the reward for gems, a crate or a pet if your game has them, and give players something to spend coins on with a shop GUI.
Never trust the client clock
It is tempting to let the client track the time and tell the server "I waited 24 hours". Don't. On the client, os.time() reads the player's device clock, and anyone can move that forward a day in their settings. A reward that trusts it can be farmed in seconds.
The fix is a strict split:
- The server owns time. Claims are judged with
os.time()on the server, and the client sends nothing the server uses. - The client only displays it. The countdown runs to NextClaim using
workspace:GetServerTimeNow(), which follows the server's clock instead of the device's.
If the display is ever off by a second, nothing breaks: the server refuses an early claim and resends the real NextClaim.
Build the popup and the countdown
Set up the UI in StarterGui:
- Insert a ScreenGui named DailyRewardsGui and turn off ResetOnSpawn, so the popup doesn't come back every time the player respawns.
- Inside it, add a Frame named Popup in the middle of the screen, with Visible turned off.
- Inside Popup, add two TextLabels named DayLabel and TimerLabel, and two TextButtons named ClaimButton and CloseButton.
- Add a small TextButton named OpenButton to the ScreenGui itself, not inside Popup, so players can open it again later.
- Insert a LocalScript into DailyRewardsGui and paste in both parts below.
-- LocalScript inside the DailyRewardsGui ScreenGui, part 1: reads the status and draws the popup
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local claimRemote = ReplicatedStorage:WaitForChild("ClaimDailyReward")
local gui = script.Parent
local popup = gui:WaitForChild("Popup")
local dayLabel = popup:WaitForChild("DayLabel")
local timerLabel = popup:WaitForChild("TimerLabel")
local claimButton = popup:WaitForChild("ClaimButton")
local busy = false
-- Seconds until the next reward, measured against the server's clock
local function secondsLeft()
local nextClaim = player:GetAttribute("DailyNextClaim") or 0
return math.max(0, math.ceil(nextClaim - workspace:GetServerTimeNow()))
end
local function refresh()
local day = player:GetAttribute("DailyDay") or 1
local reward = player:GetAttribute("DailyReward") or 0
dayLabel.Text = string.format("Day %d: %d coins", day, reward)
local left = secondsLeft()
claimButton.Visible = left == 0
if left > 0 then
local hours = math.floor(left / 3600)
local minutes = math.floor(left % 3600 / 60)
timerLabel.Text = string.format("Next reward in %02d:%02d:%02d", hours, minutes, left % 60)
else
timerLabel.Text = "Your reward is ready!"
end
endsecondsLeft subtracts the server time the client sees from NextClaim, never going below zero. refresh writes the day and the reward, then either a countdown or a ready message, and only shows the claim button once the countdown has finished. Hiding the button is only for looks, because the server checks again on every claim.
-- Same LocalScript, part 2: claiming, buttons and the popup on join (paste below part 1)
claimButton.Activated:Connect(function()
if busy then
return
end
busy = true
local ok, claimed, reward = pcall(function()
return claimRemote:InvokeServer()
end)
if ok and claimed then
timerLabel.Text = "+" .. reward .. " coins!"
task.wait(2)
end
busy = false
refresh()
end)
gui:WaitForChild("OpenButton").Activated:Connect(function()
popup.Visible = not popup.Visible
end)
popup:WaitForChild("CloseButton").Activated:Connect(function()
popup.Visible = false
end)
-- Wait for the server's first status, then open the popup if a reward is waiting
if player:GetAttribute("DailyNextClaim") == nil then
player:GetAttributeChangedSignal("DailyNextClaim"):Wait()
end
refresh()
popup.Visible = secondsLeft() == 0
-- Redraw once a second so the countdown ticks
while true do
task.wait(1)
if not busy then
refresh()
end
endThe claim button uses busy so a double click sends one request, and pcall so a failed request can't leave the button stuck. On join, the script waits for the first DailyNextClaim the server sends, then opens the popup on its own if a reward is ready. That is when players are most likely to claim: the moment they arrive. The loop at the end redraws once a second, so the countdown ticks down.
Or ask Revix to build the popup in your game's style and wire it to these scripts.
Test it without waiting a day
- Publish the place and turn on Enable Studio Access to API Services under Game Settings > Security, or nothing saves between tests.
- Set
DAYto 60 in the DailyRewards script. A day now lasts one minute, and the streak breaks after two. - Play and claim. The popup should switch to a countdown for the next day's reward.
- After a minute, claim again for day 2. Then stop, wait more than two minutes and play again: the popup should be back on day 1.
- Click the claim button several times in a row. Only one reward should arrive.
- Stop and play again. The popup should show the right day and countdown, which proves the data saved.
- Set
DAYback to24 * 60 * 60before you publish.
Players who return every day also see your game passes and developer products more often. When you are ready for that side, read how to make money from your Roblox game.
Questions
How do daily rewards work in Roblox?
The server saves the time of each player's last claim with os.time() and compares it with the current time when they try to claim again. Once 24 hours have passed they get the next day's reward, and the streak resets if more than 48 hours have passed. The last claim time and the streak are saved in a DataStore with the rest of the player's data.
How do I stop players from cheating daily rewards by changing their clock?
Only ever use the server's clock. The client asks to claim through a RemoteFunction with no arguments, and the server checks os.time() itself. The client's clock is used for nothing but the countdown display, and even that should use workspace:GetServerTimeNow().
Should daily rewards reset at midnight or 24 hours after the last claim?
Both work. A rolling 24 hours treats every player the same wherever they live, which is why this guide uses it. For a midnight reset, compare UTC day numbers, math.floor(os.time() / 86400), and keep in mind that midnight UTC is a different local time for each player.
How do I test daily rewards without waiting a day?
Set the DAY constant in the server script to 60 while you test, so a day lasts one minute and the streak breaks after two. Set it back to 24 * 60 * 60 before you publish.
Why does my daily reward streak reset every time I rejoin?
The last claim time is not being saved. Check that LastClaim and Streak are in your data template, that the place is published with Studio API access turned on, and that the Output shows no save errors.








