Lesson 5 of 11
Retention by design: quests, dailies, streaks, return reasons
Turn Beacon Yard's core loop into a habit players return to on Day 7 and Day 30 with data-driven daily and weekly quests, forgiving streaks, social return reasons and server analytics.
By the end you can
- Structure quests around objective, quantity and reward tied to Beacon Yard's real server gameplay hooks
- Rotate three daily quests and one weekly quest on server UTC boundaries without clock exploits
- Design a forgiving daily streak with a grace day so one missed visit does not cause churn
- Measure quest completion, streak health and coin inflation using custom and economy analytics events
Before this: Game design for Roblox: loops, retention, fairness, Recurring revenue: subscriptions and a season pass, Social growth: invites, referrals, notifications and events
1Why players come back on Day 7
In Game design for Roblox: loops, retention, fairness you saw that Beacon Yard is almost all core loop and very little multi-day progression. Look at what a player's saved profile holds at m14-ship:
export type ProfileData = {
coins: number,
speedOwned: boolean,
-- True once this profile has looked for a BeaconYard_v1 record, found
-- or not. A failed read leaves it false, so the next session retries.
legacyImported: boolean,
-- The furthest onboarding funnel step logged for this player (m12).
onboardingStep: number,
-- The last 50 developer product purchase ids this profile was paid
-- for (m14). The id is saved in the same write as the coins, so a
-- receipt Roblox delivers again is recognised. See ReceiptRules.
recentPurchaseIds: { string },
Five fields: coins, speedOwned, legacyImported, onboardingStep and recentPurchaseIds. Nothing tracks what the player finished today, what they are working toward this week, or how many days in a row they visited the yard.
Roblox's retention guide separates three horizons1. Day 1 reflects onboarding, the core loop and performance. Day 7 depends on progression and short-to-mid-term goals. Day 30 rests on the ending system: fresh content and social mechanics. Daily stipends from Recurring revenue: subscriptions and a season pass only reward clicking join; real retention systems reward playing the core loop in a slightly different way each visit.
Looking at DataMigration.ProfileData at m14-ship, why does Beacon Yard struggle to hold Day 7 players once they own Speed?
Answer
The profile stores no active quests, weekly goals or streak state, so nothing asks the player to return tomorrow. Once speedOwned is true, the saved record has no mid-term objective left. Quests, weekly milestones and streaks give the next visit a clear reason.
Open this step in lesson mode · Link to this step · This confused me
2Quest structure: objective, quantity, reward
Roblox's quest design guide breaks every quest into three parts: an objective (what action counts), a quantity (how many times) and a reward (the payout that makes the effort feel worthwhile)2. It separates achievements (one-time badges like FIRST_DRILL and DRONE_DOWN), quest chains (one step unlocking the next) and daily questsDaily questA short task with a modest reward that resets every 24 hours on a server-controlled UTC clock.Think of it as a fresh sticky note on the yard notice board each morning. (short 24-hour tasks sized for one play session).
Good dailies pull players across systems they already enjoy instead of inventing busywork. In Beacon Yard, four server services already know when key actions happen: CoinService (pads collected), CombatService (the drone brought down), CrawlerService (crawlers knocked out) and RoundService (drills survived). At m16-design-pass they announce those moments through one small module, GameEvents, so QuestService listens in one place and the services never need to know quests exist.
Match each Beacon Yard daily quest objective to the server service that already owns its truth.
Answer
Collect 20 coins from pads: CoinService; Bring down the drone once: CombatService; Knock out 3 scrap crawlers: CrawlerService; Survive 2 full drills: RoundService. Hooking QuestService to existing authoritative server events guarantees a client can never fake quest progress.
Open this step in lesson mode · Link to this step · This confused me
3Daily and weekly rotation without clock exploits
Two bugs ruin live quest boards. First, reading the client's local time lets a player move their phone clock forward a day to reset dailies on demand. Second, storing a random roll per server causes players who server-hop to see a brand-new set of dailies every minute.
The clean fix uses integer division on server UTC time: dayKey = math.floor(os.time() / 86400) for dailies and weekKey = math.floor(os.time() / 604800) for the weekly milestone. Feed dayKey as the seed to a deterministic selector, and every server in the world picks the exact same three distinct dailies for that UTC day with zero extra DataStore calls.
Two details a live team checks before launch. Unix time started on a Thursday (1970-01-01), so math.floor(os.time() / 604800) rolls the week over on Thursday 00:00 UTC. For a Monday reset, shift by four days: math.floor((os.time() - 4 * 86400) / 604800). And UTC midnight is mid-afternoon or evening in the Americas, so pick the reset hour for where most of your players live, not for where the server clock happens to be.
Run this cell to test deterministic three-daily selection across two UTC days and confirm no duplicates appear.
local POOL = {
{ id = "d_coins", event = "coin", target = 20, reward = 15 },
{ id = "d_hits", event = "drone_down", target = 1, reward = 15 },
{ id = "d_survive", event = "drill_survived", target = 2, reward = 20 },
{ id = "d_crawler", event = "crawler_down", target = 2, reward = 15 },
{ id = "d_shop", event = "purchase", target = 1, reward = 10 },
}
local function pickDailies(pool, dayKey, count)
local available = table.clone(pool)
local picked = {}
local state = math.abs(dayKey * 48271 + 17) % 65537
for _ = 1, math.min(count, #available) do
state = (state * 48271 + 17) % 65537
local idx = (state % #available) + 1
table.insert(picked, available[idx].id)
table.remove(available, idx)
end
return picked
end
local a = pickDailies(POOL, 20400, 3)
local b = pickDailies(POOL, 20400, 3)
local c = pickDailies(POOL, 20401, 3)
local same = table.concat(a, ",") == table.concat(b, ",")
local changed = table.concat(a, ",") ~= table.concat(c, ",")
print(string.format("Day 20400: %d distinct | Repeat match: %s | Rotated on 20401: %s", #a, tostring(same), tostring(changed)))
Day 20400: 3 distinct | Repeat match: true | Rotated on 20401: trueA player finishes a daily quest at 23:59:59 UTC (unix = 86399) and joins again two seconds later at 00:00:01 UTC (unix = 86401). What does this print?
local d1 = math.floor(86399 / 86400)
local d2 = math.floor(86401 / 86400)
print(d1, d2, d2 > d1)
Answer
0 1 true. Comparing stored dayKey against math.floor(os.time() / 86400) rolls dailies over cleanly at UTC midnight regardless of the player's device clock.
Open this step in lesson mode · Link to this step · This confused me
4Streaks that forgive instead of punish
| In the picture | In Roblox |
|---|---|
| Today's stamp | One UTC day key (os.time() // 86400) recorded in the server profile |
| Free drink on stamp seven | A weekly quest or day-seven streak milestone reward |
| One spare stamp per week | A grace window that preserves the streak after a single missed day on a 7-day cooldown |
Treat a daily streak like a cafe stamp card that includes one spare punch per week. Visiting tomorrow adds a stamp, missing a busy Tuesday uses your grace dayGrace dayA forgiveness window that lets a player miss one calendar day without losing their login or play streak.Think of it as a spare punch on a coffee card so one busy Tuesday does not wipe out a two-week habit., and missing several days starts a fresh card without shaming the player.
Think of it as A cafe stamp card with a spare stamp for one missed day
Strict streaks backfire in live games. A player on Day 11 who misses one day for travel or homework opens the game, sees Day 1, feels their effort was erased, and closes the app for good. Adding a one-day grace window on a seven-day cooldown fixes that cliff:
gap == 0: same UTC day, do nothing (idempotent).gap == 1: consecutive day, incrementcount.gap == 2: missed one full day. IflastGraceDay == nilortoday - lastGraceDay >= 7, incrementcountand setlastGraceDay = today. Otherwise resetcount = 1.gap >= 3: missed two or more days, resetcount = 1.
Stored dataRemember: Dailies and forgiving streaks is a cafe stamp card with a spare stamp for one missed day.
Now think carefully about where the stamp card stops working before opening the breakdown below.
Where does it break?“A cafe stamp card with a spare stamp for one missed day” is a good picture of dailies and forgiving streaks. Where does it stop being true?
It breaks here. A stamp card does not care whether the coffee tastes good; quests and streaks that pay for logging in without fun turn play into a chore and collapse Day 30 retention once players tire of the routine.
The true model. Quests, dailies and forgiving streaks structure return reasons around actions the player already enjoys. Rollovers use server UTC timestamps, progress hooks fire from server gameplay services, and claims save atomically inside ProfileStore.
A player has count = 5, lastDay = 100 and lastGraceDay = 95 (cooldown is 7 days). They miss Day 101 and return on Day 102. What does this print?
local count, lastDay, lastGraceDay = 5, 100, 95
local today = 102
local gap = today - lastDay
local graceReady = (today - lastGraceDay) >= 7
local nextCount = if gap == 2 and graceReady then count + 1 else 1
print(gap, graceReady, nextCount)
Answer
2 true 6. Because 7 days have passed since lastGraceDay (95), the grace window is recharged on Day 102 and saves the player's streak.
Open this step in lesson mode · Link to this step · This confused me
6Build it: Beacon Yard's quest board and streak tracker
Now wire the design into Beacon Yard's m16-design-pass milestone. Store the player's quest board and streak inside DataMigration.ProfileData so ProfileStore's session:Reconcile() automatically fills defaults for existing players with older profiles.
Build along
src/server/DataMigration.luausrc/shared/data/quests.jsonsrc/shared/Quests.luausrc/server/GameEvents.luausrc/shared/AnalyticsFields.luausrc/server/Analytics.luausrc/server/QuestService.luausrc/client/QuestGui.luau
Extend
ProfileDataandDataMigration.template()withquestDayKey: number,questWeekKey: number,dailySlots: { QuestSlot },weeklySlot: QuestSlot?andstreak: { count, lastDay?, lastGraceDay? }.You should see Existing profiles gain questDayKey = -1, questWeekKey = -1, empty dailySlots and streak = { count = 0 } through Reconcile without losing coins.
Put the quest pool in
src/shared/data/quests.json, then addsrc/shared/Quests.luau, the finished version of this lesson's level 3 challenge:utcDay,utcWeek,pickDailies,recordProgress,claimQuestandadvanceStreakwith a 7-day grace cooldown. It holds rules only, so the pool can change without touching code.You should see quests.json lists five dailies (PadRun, Survivor, Scrapper, DroneDown, Tinkerer) and two weeklies (YardWeek, survive 15 drills for 150 coins; Teamwork, repair the beacon with another player twice for 60 coins), each with id, label, kind, event, target and reward.
Create
src/server/GameEvents.luau, one signal that gameplay services fire.CoinService,CombatService,CrawlerService,CoopService,ShopServiceandUpgradeServicefire it directly, andRoundServicereaches it throughDrillDirector.afterDrillfor a survived drill.You should see GameEvents.fire(player, event) is called with coin, drill_survived, crawler_down, drone_down, purchase, repair and upgrade.
Add
src/shared/AnalyticsFields.luau, a purebuild(fields)that turns a list of strings into theCustomField01toCustomField03dictionary, and giveAnalytics.logan optionalfieldsargument that passes it toLogCustomEvent. Keep field values to a small fixed set (an outcome, a quest id), never a user id or a timestamp.You should see Analytics.log(player, name, value?, fields?) sends up to three string fields as CustomField01 to CustomField03, and AnalyticsFields.build drops empty strings and ignores any past the third.
Create
src/server/QuestService.luau.refreshdraws the dailies withpickDailies(daily, day, 3)and the weekly withpickDailies(weekly, week, 1). It listens toGameEvents.fired, handles theClaimQuestremote behindRemoteGuard, and logsquest_completedandquest_claimedwith the quest id as a field,streak_updatedwith the outcome as a field, plusAnalytics.coinSourcewithDailyQuest,WeeklyQuest(bothGameplay) orStreakBonus(TimedReward).visitadvances the streak from thedrill_survivedgame event, so only the first survived drill of a UTC day counts: a streak rewards playing, not logging in.You should see Joining on a new UTC day draws three distinct dailies; a new UTC week draws one weekly. The streak moves on the first drill survived each UTC day, not on join. A Claim pays once, and a growing streak pays a StreakBonus of 2 coins per day, capped at 7 days.
Build
src/client/QuestGui.luauto render the board from the Store and fireClaimQuestwith only the quest id when a finished row's button is clicked.You should see K (or D-pad left) opens QuestGui with the three dailies, the weekly, live progress bars and the streak counter with Grace Ready status.
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Custom ProfileStore QuestService (Beacon Yard) | Pure Luau rotation, progress and forgiving streak saved inside the player's existing ProfileStore record. | You already use ProfileStore and want atomic coin-plus-claim saves with zero extra DataStore keys. | You build and test the quest UI and rollover rules yourself. |
| Roblox Missions feature package (beta) | Official Studio package from Creator Store (requires the Core feature package) with mission IDs, categories, tasks and rewards. | Prototyping standard quests quickly on a fresh project without a custom profile schema. | Marked beta in Roblox docs as of 2026-11-25; uses its own Core DataStore layer instead of your ProfileStore profile. |
| External LiveOps backend over HttpService | Quests and schedules pulled from your own web API. | Large multi-game studios running cross-experience campaigns and segmented live offers. | Requires hosting, HTTP rate-limit handling, caching and offline fallbacks. |
Why should Beacon Yard save slot.claimed = true inside the same ProfileStore Data table where DataService.addCoins adds the reward?
Answer
So a server crash or session handover can never save the coins while forgetting that the quest was already claimed. Just like recentPurchaseIds in DataMigration.luau, storing claimed state alongside coins in one ProfileStore record eliminates duplicate-claim exploits across crashes.
Open this step in lesson mode · Link to this step · This confused me
7Challenges
Fix advanceStreak below so rejoining the same day does nothing, a one-day gap increments, and a two-day gap uses the grace window when at least 7 days have passed since lastGraceDay.
local GRACE_COOLDOWN = 7
local function advanceStreak(state, today)
if state.lastDay == nil then
return { count = 1, lastDay = today, lastGraceDay = state.lastGraceDay }, "started"
end
local gap = today - state.lastDay
if gap <= 0 then
return { count = state.count, lastDay = state.lastDay, lastGraceDay = state.lastGraceDay }, "same_day"
end
if gap == 1 then
return { count = state.count + 1, lastDay = today, lastGraceDay = state.lastGraceDay }, "incremented"
end
-- Bug: never checks the 1-day grace window when gap == 2.
return { count = 1, lastDay = today, lastGraceDay = state.lastGraceDay }, "reset"
end
local s1, st1 = advanceStreak({ count = 4, lastDay = 100, lastGraceDay = nil }, 102)
print(st1, s1.count, s1.lastGraceDay)
Level 1, Apprentice
Challenge
Fix advanceStreak in the streak-fix cell so a single missed day invokes the forgiving grace window on a 7-day cooldown.
- Start from
- The game at milestone m14 (download)
- Check it here
- Run the code cell in the lesson view; the challenge completes when it passes. No Studio needed.
Done means
- gap == 2 triggers grace_used when lastGraceDay is nil or today - lastGraceDay is at least 7
- Using grace increments count and records lastGraceDay = today
- All four assertions in streak-fix pass
Hints
- Check if gap == 2 before falling through to reset.
- Compute graceReady = state.lastGraceDay == nil or (today - state.lastGraceDay) >= GRACE_COOLDOWN.
Solution
local GRACE_COOLDOWN = 7
local function advanceStreak(state, today)
if state.lastDay == nil then
return { count = 1, lastDay = today, lastGraceDay = state.lastGraceDay }, "started"
end
local gap = today - state.lastDay
if gap <= 0 then
return { count = state.count, lastDay = state.lastDay, lastGraceDay = state.lastGraceDay }, "same_day"
end
if gap == 1 then
return { count = state.count + 1, lastDay = today, lastGraceDay = state.lastGraceDay }, "incremented"
end
if gap == 2 then
local graceReady = state.lastGraceDay == nil or (today - state.lastGraceDay) >= GRACE_COOLDOWN
if graceReady then
return { count = state.count + 1, lastDay = today, lastGraceDay = today }, "grace_used"
end
end
return { count = 1, lastDay = today, lastGraceDay = state.lastGraceDay }, "reset"
end
local s1, st1 = advanceStreak({ count = 4, lastDay = 100, lastGraceDay = nil }, 102)
print(st1, s1.count, s1.lastGraceDay)
Level 2, Builder
Challenge
Write a one-page Beacon Yard Quest & Streak Balance Table that adds daily variety without inflating the coin economy.
- Start from
- The game at milestone m14 (download)
Done means
- Design a pool of six Beacon Yard daily quests and two weekly quests, each naming its objective, quantity, reward and server hook
- Verify that the three dailies plus a full streak bonus pay at most 25% of a 10-minute player's normal drill income (about 119 of 475 coins)
- Include at least one co-op or social quest that encourages playing with a teammate
Hints
- A 4-pad drill pays 38 coins every 48 seconds, so 10 minutes (12.5 drills) pays about 475 coins and the cap is about 119. Check the worst draw: Beacon Yard's top three dailies (30 + 25 + 25) plus the 14-coin streak bonus come to 94.
- Tie every quest to an authoritative server hook so none relies on client self-reporting.
Testing pure retention rules without waiting 24 hours
Before writing DataStore code, isolate UTC rollovers, deterministic rotation, claim guards and grace-day transitions into a pure Luau module so every edge case runs in milliseconds inside the Course Runner.
Level 3, Professional
Challenge
Start from m14-ship in the game repo and implement the pure quest rotation, claim and forgiving-streak rules in challenges/work/retention_rules.luau, then verify with game.ServerScriptService.RunGameTests:Invoke("retention-design", "retention-rules-lab").
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("retention-design", "retention-rules-lab")in the server command bar. Copy the pass code from Output.
Done means
- challenges/work/retention_rules.luau computes UTC day and week keys accurately
- pickDailies returns distinct deterministic quests that rotate across days and clamp to the pool size
- recordProgress filters by event, ignores non-positive values and clamps at target; claimQuest pays once only
- advanceStreak implements started, same_day, incremented, grace_used (7-day cooldown) and reset without mutating input
- RunGameTests:Invoke("retention-design", "retention-rules-lab") passes all 15 checks
Hints
- Use math.floor(unixSeconds / 86400) for utcDay and math.floor(unixSeconds / 604800) for utcWeek.
- Clone the pool in pickDailies and remove each picked entry so duplicates are impossible.
- Check slot.claimed or slot.progress < slot.target before granting a reward.
Two weeks after shipping the quest board, your Explore dashboard shows five dailies at 68 to 76% completion, and one daily ('Destroy 12 crawlers in one day') at 9% completion. What is the best fix?
Answer
Lower the quantity to 2 or 3 crawlers (sized for a single 10-minute session) and keep watching the Explore chart. A 9% completion rate signals a quantity mismatch, not a reward shortage. Match the target to one normal play session.
Open this step in lesson mode · Link to this step · This confused me
8Recap
Retiring the analogy
You no longer need “a cafe stamp card with a spare stamp for one missed day”. Quests, dailies and forgiving streaks structure return reasons around actions the player already enjoys. Rollovers use server UTC timestamps, progress hooks fire from server gameplay services, and claims save atomically inside ProfileStore.
Recap
- Structure every quest around objective, quantity and reward, wired strictly to authoritative server gameplay hooks.
- Drive daily and weekly resets from server UTC day and week keys with deterministic selection so client clock tricks and server hopping cannot farm extra resets.
- Include a one-day grace window on a cooldown so streaks build habits without punishing real-life schedules.
- Pair quests with social return reasons (co-op weeklies, invites, scheduled events), and give every social daily a solo fallback.
- Track quest_completed, quest_claimed and separate economy SKUs (DailyQuest, WeeklyQuest, StreakBonus) to protect both completion rates and economy balance.
Dailies and forgiving streaks is a cafe stamp card with a spare stamp for one missed day, until a stamp card does not care whether the coffee tastes good; quests and streaks that pay for logging in without fun turn play into a chore and collapse Day 30 retention once players tire of the routine.
Queued for review
- Looking at DataMigration.ProfileData at m14-ship, why does Beacon Yard struggle to hold Day 7 players once they own Speed?
- Match each Beacon Yard daily quest objective to the server service that already owns its truth.
- A player finishes a daily quest at 23:59:59 UTC (unix = 86399) and joins again two seconds later at 00:00:01 UTC (unix = 86401). What does this print?
- A player has count = 5, lastDay = 100 and lastGraceDay = 95 (cooldown is 7 days). They miss Day 101 and return on Day 102. What does this print?
- Which practices keep Beacon Yard's quest board measurable and safe for the economy?
- Why should Beacon Yard save slot.claimed = true inside the same ProfileStore Data table where DataService.addCoins adds the reward?
Open this step in lesson mode · Link to this step · This confused me
5Social return reasons and measuring every hook
Quests and streaks pull a solo player back. Friends pull them back harder. In Social growth: invites, referrals, notifications and events you saw invites, referrals, opt-in notifications and Experience Events. Pair those with your quest board: a weekly quest like "Survive 5 drills with at least one teammate" gives players a concrete reason to invite a friend, and a scheduled Scrap Rush event creates a shared calendar moment.
A social daily needs a solo fallback. A daily is sized for one session, and a player who logs in alone cannot finish "repair the beacon with another player". Beacon Yard's
Teamworkquest started as a daily with exactly this flaw: the co-op levers only appear with two or more players. It now sits in the weekly pool ("Repair the beacon with another player", 2 repairs, 60 coins), so a player has the whole week to find a partner.Every retention feature must be measured on two axes: does it lift D7 retention, and does it break the economy? Beacon Yard already wraps both analytics calls in
Analytics.luau:Log
quest_completedandquest_claimedwithAnalytics.log(player, name, slot.reward, { slot.id }). A custom event carries one number plus up to three string custom fields, and Roblox's guide uses quest names as its own example and recommends fields over extra event names3. So the reward is the value and the quest id goes inCustomField01, which lets the Explore page break completion down by quest. The streak logs one event,streak_updated, with the new count as the value and the outcome (incremented,grace_used,reset) as a field. Log every quest or streak coin payout throughAnalytics.coinSourcewith distinct SKUs ("DailyQuest","WeeklyQuest","StreakBonus")4. Quests use theGameplaytransaction type; the StreakBonus is a scheduled daily reward, so it usesTimedReward. The streak bonus is small on purpose: 2 coins per streak day, capped at 7 days, so at most 14 coins. On the Economy page, check that quest coins stay a modest supplement (for example, 15 to 25 percent of normal drill income) rather than replacing active play.Select a numbered pin, or a row below, to read what it marks.
Beacon Yard's Quest Board in Play: three rotating dailies, one weekly milestone and a forgiving streak indicator.
QWhich practices keep Beacon Yard's quest board measurable and safe for the economy?
Answer
ALog quest payouts via Analytics.coinSource with separate SKUs for DailyQuest, WeeklyQuest and StreakBonus; Log quest_completed and quest_claimed as server custom events so you can check each quest's completion rate; Keep daily quest totals modest compared to normal drill earnings so players still play rounds instead of farming checklists. Separate economy SKUs reveal whether quests cause inflation, custom events expose unpopular or broken quests, and the server must always look up rewards from its own quest table.
Open this step in lesson mode · Link to this step · This confused me