Lesson 11 of 11
Capstone, part 1: brief, rules and two yard extensions
Part 1 of the Beacon Yard capstone starts from your own m14-ship game: learn the five rules updated for ProfileStore, then build and Studio-grade two in-game extensions (a Swarm target tag and a daily coin grant).
By the end you can
- Extend your own m14-ship Beacon Yard repository while keeping its five server-authority and ProfileStore rules intact
- Add a second wrench target tag (Swarm) directly in CombatService and prove it with a Studio playtest
- Add a ProfileStore-backed daily coin grant with Reconcile support and prove it on the live DataService
Before this: Integration playtests, ProfileStore: the library pros use, Monetization: products, passes, subscriptions, economy, Publishing: versions, rollback, store page
1Start from m14-ship, and the five rules that stay
Start from your own completed m14-ship repository, not an earlier milestone. Before you change a single line, open ReplicatedStorage.GameTests and make sure ServerScriptService.RunGameTests:Invoke() passes on your current build.

Select a numbered pin, or a row below, to read what it marks.
The playtest module, GameTests. Select a pin to see which rule each check protects.
Every capstone project keeps the same five rules. They are not style preferences. Breaking one opens a cheat, splits client and server truth, or loses a player's coins.
- Every price, duration, health and reward number lives in
src/shared/Config.luau, once. UI and tests read that constant instead of copying the number. - Any new remote is named in
src/server/Remotes.luauand created on the server. Clients wait for it. - Coins, damage, pass ownership and purchases are decided on the server.
- A new saved field has a default in
DataMigration.template(), is filled in for existing profiles byProfileStore'sReconcile(), and is mutated only on the server's active session. A player whose session failed to start stays memory-only and never overwrites stored data. - Developer products stay on
ProcessReceipt. A game pass never replacesProcessReceipt, and a failed save never returnsPurchaseGranted.
ROUND_SECONDS = 40,
COOLDOWN_SECONDS = 8,
COIN_VALUE = 5,
COIN_RESPAWN_SECONDS = 4,
SURVIVAL_BONUS = 10,
DRONE_SPEED = 12,
DRONE_DAMAGE = 15,
DRONE_HIT_COOLDOWN = 1,
DRONE_MAX_HEALTH = 100,
WRENCH_DAMAGE = 34,
WRENCH_RANGE = 14,
STUN_SECONDS = 1.6,
WALK_SPEED = 16,
BOOST_SPEED = 24,
SPEED_PRICE = 25,
SHIELD_PRICE = 40,
COIN_PACK_COINS = 50,
The wrench deals Config.WRENCH_DAMAGE and the drone starts with Config.DRONE_MAX_HEALTH. How many swings must hit to destroy one drone?
Answer
3. 100 minus 34 is 66, minus 34 is 32, and a third hit takes it to -2. Three hits destroy the drone. Do not retune either number to make a capstone test easier.
Under Rule 4 at m14-ship, what must happen when a player's ProfileStore session fails to start on join?
Answer
Keep their fallback profile in server memory only and never overwrite their stored DataStore key. DataService places failed loads into memoryOnly so the player can keep playing without risking overwriting a locked profile.
Open this step in lesson mode · Link to this step · This confused me
2Project 1: why a new tag misses until CombatService looks for it
At m14-ship, CombatService.luau casts a ray with Enum.RaycastFilterType.Include across two CollectionService tags: Drone and Crawler1. Anything without one of those tags is invisible to the wrench.
Both sidesRemember: CollectionService tags is coloured stickers.
params.FilterType = Enum.RaycastFilterType.Include
local targets = CollectionService:GetTagged(DRONE_TAG)
for _, crawler in CollectionService:GetTagged(CRAWLER_TAG) do
table.insert(targets, crawler)
end
params.FilterDescendantsInstances = targets
Adding a third enemy type called Swarm means two places in CombatService.luau have to know the tag: the include list built for workspace:Raycast, and targetTag when routing the hit. Leave either one out and every swing passes straight through or returns "miss".
Where does it break?“Coloured stickers” is a good picture of collectionservice tags. Where does it stop being true?
It breaks here. A sticker does nothing until code looks for it, and a tag on the drone's root does not tag its children.
The true model. A tag is a string stored on one instance and replicated from the server. Behaviour comes from the code that queries tags, which is why tags suit marking things for systems such as raycast filters, pads and pickups.
You tag a new enemy root part Swarm, but CombatService still builds its include list only from Drone and Crawler. What happens when a player swings the wrench at the Swarm part?
Answer
The ray passes through it and returns miss, because the sticker is ignored unless code asks for it. An Include filter sees only the instances you place in FilterDescendantsInstances. A Swarm part stays invisible until CombatService appends CollectionService:GetTagged("Swarm") and handles the Swarm tag.
Open this step in lesson mode · Link to this step · This confused me
3Build and grade Project 1 in Studio
Before editing CombatService.luau, check your understanding of the include-list rule and health math in the browser cell below. With SWARM_MAX_HEALTH = 50 and WRENCH_DAMAGE = 34, the first hit leaves 16 and the second hit destroys the target (-18 <= 0).
local function rayHits(includeTags, partTag)
for _, tag in includeTags do
if tag == partTag then
return true
end
end
return false
end
local before = if rayHits({ "Drone", "Crawler" }, "Swarm") then "hit" else "miss"
local after = if rayHits({ "Drone", "Crawler", "Swarm" }, "Swarm") then "hit" else "miss"
local h1 = 50 - 34
local h2 = h1 - 34
print(before, after, h1, h2)
miss hit 16 -18Now make the real in-game change in your m14-ship checkout:
- In
src/shared/Config.luau, addSWARM_MAX_HEALTH = 50without alteringWRENCH_DAMAGE(34) orDRONE_MAX_HEALTH(100). - In
src/server/CombatService.luau, addlocal SWARM_TAG = "Swarm", recognize it intargetTag, appendCollectionService:GetTagged(SWARM_TAG)totargetsinsideCombatService.trySwing, and whentag == SWARM_TAG, subtractConfig.WRENCH_DAMAGEfrom the hit part'sHealthattribute and destroy the ancestorModel(or part) whenHealth <= 0. - Press Play and run
game.ServerScriptService.RunGameTests:Invoke("capstone_swarm", "capstone-swarm")in the server command bar. The Course Runner uses the liveCombatService. Copy the pass code from Output once the checks pass.
Level 3, Professional
Challenge
Extend src/shared/Config.luau and src/server/CombatService.luau in your m14-ship game, then run challenges/capstone_swarm.luau in Studio. Solution: challenges/solutions/capstone-yard-extensions.md.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("capstone_swarm", "capstone-swarm")in the server command bar. Copy the pass code from Output.
Done means
- Config.SWARM_MAX_HEALTH is set to a positive number (50 recommended) while WRENCH_DAMAGE stays 34 and DRONE_MAX_HEALTH stays 100
- Swinging at an untagged decoy part still returns miss
- Swinging at a Swarm-tagged target returns hit and subtracts Config.WRENCH_DAMAGE from its Health attribute
- A lethal swing destroys the Swarm model, and challenges/capstone_swarm.luau prints TEST PASS for all four checks
Hints
- In CombatService.luau, update both targetTag() and the targets list passed to params.FilterDescendantsInstances.
- Read the hit instance's Health attribute with targetRoot:GetAttribute("Health") and write the reduced value back before checking <= 0.
- Use the existing RunGameTests bindable so the test shares the running server's CombatService.
Why do you run capstone_swarm through RunGameTests instead of requiring CombatService from the command bar?
Answer
The Studio command bar has its own require cache, so requiring a server module there returns a separate, unstarted copy. The command bar keeps a separate require cache from ServerScriptService scripts. A BindableFunction created in init.server.luau runs inside the server script's cache and sees the live started services.
Open this step in lesson mode · Link to this step · This confused me
4Project 2: a daily coin grant on ProfileStore
From m10-memory onward, DataService.luau no longer hand-rolls UpdateAsync calls for player profiles. ProfileStore owns the session lock, autosaves, and BindToClose2. Adding a daily coin grant means adding one new field (lastDaily) to the template so Reconcile() populates it for every returning player automatically.
function DataMigration.template(): ProfileData
return {
coins = 0,
speedOwned = false,
legacyImported = false,
onboardingStep = 0,
session:AddUserId(player.UserId)
session:Reconcile()
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| ProfileStore (m10-memory onward) | Wally package managing one session-locked profile per player, autosaving, and filling new fields with Reconcile(). | Production games and every extension from m10 onward in Beacon Yard. | Requires a Wally dependency and lives in its own store (BeaconYard_v2), so legacy records need a one-time import. |
| Hand-rolled DataStore with UpdateAsync | The m06 to m09 implementation: manual session locks, retries and BindToClose. | Learning how session locking works under the hood, or tiny tools with one key. | You maintain every race condition, failed-load fallback and shutdown edge yourself. |
| ProfileService or DataStore2 | Earlier community libraries for session-locked saving. | Only when maintaining an existing codebase that already uses them. | Both are legacy; ProfileStore is the successor from the same author as ProfileService. |
A reconciled profile has coins = 10 and lastDaily = 0. DAILY_COINS is 25 and DAILY_INTERVAL_SECONDS is 86400. What does this print when claimDaily runs at t = 1000 and again at t = 2000?
local data = { coins = 10, lastDaily = 0 }
local function claim(now)
if data.lastDaily ~= 0 and now - data.lastDaily < 86400 then
return 0
end
data.lastDaily = now
data.coins += 25
return 25
end
print(claim(1000), claim(2000), data.coins)
Answer
25 0 35. The first call sees lastDaily == 0, pays 25 coins, and stamps lastDaily = 1000. The second call is only 1000 seconds later, so it pays 0 and leaves coins at 35.
Open this step in lesson mode · Link to this step · This confused me
5Build and grade Project 2 in Studio
Wire the daily grant directly into your m14-ship game:
-
In
src/shared/Config.luau, addDAILY_COINS = 25andDAILY_INTERVAL_SECONDS = 86400. -
In
src/server/DataMigration.luau, addlastDaily: numbertoProfileDataandlastDaily = 0toDataMigration.template(). -
In
src/server/DataService.luau, addDataService.claimDaily(player: Player, now: number?): number. Wait for the player's profile withwaitProfile(player), useif now ~= nil then now else os.time(), return0inside the interval, otherwise setdata.lastDaily, addConfig.DAILY_COINS, callpushCoins(player)soleaderstats.Coinsupdates, and returnConfig.DAILY_COINS. -
Press Play and run
game.ServerScriptService.RunGameTests:Invoke("capstone_daily_profile", "capstone-daily-profile")in the server command bar. The test runs two parts. First it opens aProfileStore.Mocksession, deleteslastDailyfrom that in-memory profile and callsReconcile()on the same session. It does not save and reopen an older record, so it proves the template default andReconcile()call, not a full upgrade of a stored profile. Second, it runsclaimDailyagainst the live profile of the player in your Play session, then putslastDailyand your coins back.Grade on a disposable profile. The second part changes the real profile in memory. It runs inside
pcall, so your coins andlastDailyare put back even if yourclaimDailythrows, and the error shows up as a faileddaily_claim_errorcheck. Pressing Stop during the test restores nothing, and ProfileStore can autosave a half-finished change. Use a staging place and a throwaway account, and checkleaderstats.Coinsafter an interrupted run.
Level 3, Professional
Challenge
Extend Config.luau, DataMigration.luau and DataService.luau in your m14-ship game, then run challenges/capstone_daily_profile.luau in Studio. Solution: challenges/solutions/capstone-yard-extensions.md.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("capstone_daily_profile", "capstone-daily-profile")in the server command bar. Copy the pass code from Output.
Done means
- Config.DAILY_COINS and Config.DAILY_INTERVAL_SECONDS are positive constants in Config.luau
- DataMigration.template().lastDaily is 0, and Reconcile() restores lastDaily = 0 on a mock profile whose lastDaily was removed in memory
- DataService.claimDaily(player, now) pays Config.DAILY_COINS on first claim, updates leaderstats.Coins, returns 0 inside the interval, and pays again once the interval passes
- challenges/capstone_daily_profile.luau prints TEST PASS for all six checks
Hints
- Do not call DataStoreService:UpdateAsync; mutating session.Data lets ProfileStore autosave and persist on EndSession.
- Call pushCoins(player) right after data.coins += Config.DAILY_COINS so leaderstats.Coins matches the profile.
- Accept an optional now parameter so the test can advance time without waiting 24 real hours.
A returning player saved their profile before you added lastDaily. What happens when they join your updated m14-ship server?
Answer
session:Reconcile() copies lastDaily = 0 from DataMigration.template() without touching their existing coins or speedOwned. Reconcile fills in any key present in the template table that is missing from the loaded profile, leaving existing fields untouched.
Open this step in lesson mode · Link to this step · This confused me
6Recap
Retiring the analogy
You no longer need “coloured stickers”. A tag is a string stored on one instance and replicated from the server. Behaviour comes from the code that queries tags, which is why tags suit marking things for systems such as raycast filters, pads and pickups.
Recap
- The capstone starts from your completed m14-ship game and preserves all five rules, with Rule 4 updated for ProfileStore templates and Reconcile().
- Project 1 extends CombatService's raycast include list and targetTag for Swarm targets, verified live by challenges/capstone_swarm.luau.
- Project 2 adds lastDaily to DataMigration.template() and DataService.claimDaily(), verified against ProfileStore's Mock and live leaderstats by challenges/capstone_daily_profile.luau.
CollectionService tags is coloured stickers, until a sticker does nothing until code looks for it, and a tag on the drone's root does not tag its children.
Queued for review
- The wrench deals Config.WRENCH_DAMAGE and the drone starts with Config.DRONE_MAX_HEALTH. How many swings must hit to destroy one drone?
- You tag a new enemy root part Swarm, but CombatService still builds its include list only from Drone and Crawler. What happens when a player swings the wrench at the Swarm part?
- A reconciled profile has coins = 10 and lastDaily = 0. DAILY_COINS is 25 and DAILY_INTERVAL_SECONDS is 86400. What does this print when claimDaily runs at t = 1000 and again at t = 2000?
- A returning player saved their profile before you added lastDaily. What happens when they join your updated m14-ship server?
Next Capstone, part 2: cosmetic pass trail, localization and thumb targets
Open this step in lesson mode · Link to this step · This confused me