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).

Project lesson, about 70 minutes, 6 steps

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

Step 1 of 6

Start 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.

Roblox Studio
Studio's script editor showing the playtest module GameTests, with the coin pickup test asserting that a coin adds Config.COIN_VALUE and a test attribute shortening the coin respawn.

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.

  1. 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.
  2. Any new remote is named in src/server/Remotes.luau and created on the server. Clients wait for it.
  3. Coins, damage, pass ownership and purchases are decided on the server.
  4. A new saved field has a default in DataMigration.template(), is filled in for existing profiles by ProfileStore's Reconcile(), 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.
  5. Developer products stay on ProcessReceipt. A game pass never replaces ProcessReceipt, and a failed save never returns PurchaseGranted.
	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,
Work it out

The wrench deals Config.WRENCH_DAMAGE and the drone starts with Config.DRONE_MAX_HEALTH. How many swings must hit to destroy one drone?

Choose one

Under Rule 4 at m14-ship, what must happen when a player's ProfileStore session fails to start on join?

Under Rule 4 at m14-ship, what must happen when a player's ProfileStore session fails to start on join?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 2 of 6

Project 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.

Choose one

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?

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?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 3 of 6

Build 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).

Luau
Ctrl Enter runs the cell. Checked against the expected output

Now make the real in-game change in your m14-ship checkout:

  1. In src/shared/Config.luau, add SWARM_MAX_HEALTH = 50 without altering WRENCH_DAMAGE (34) or DRONE_MAX_HEALTH (100).
  2. In src/server/CombatService.luau, add local SWARM_TAG = "Swarm", recognize it in targetTag, append CollectionService:GetTagged(SWARM_TAG) to targets inside CombatService.trySwing, and when tag == SWARM_TAG, subtract Config.WRENCH_DAMAGE from the hit part's Health attribute and destroy the ancestor Model (or part) when Health <= 0.
  3. Press Play and run game.ServerScriptService.RunGameTests:Invoke("capstone_swarm", "capstone-swarm") in the server command bar. The Course Runner uses the live CombatService. 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

The Course Runner prints this code when the test passes.

Choose one

Why do you run capstone_swarm through RunGameTests instead of requiring CombatService from the command bar?

Why do you run capstone_swarm through RunGameTests instead of requiring CombatService from the command bar?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 4 of 6

Project 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

OptionWhat it isWhen pros pick itTrade-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 UpdateAsyncThe 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 DataStore2Earlier 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.
Predict the output

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)
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?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 5 of 6

Build and grade Project 2 in Studio

Wire the daily grant directly into your m14-ship game:

  1. In src/shared/Config.luau, add DAILY_COINS = 25 and DAILY_INTERVAL_SECONDS = 86400.

  2. In src/server/DataMigration.luau, add lastDaily: number to ProfileData and lastDaily = 0 to DataMigration.template().

  3. In src/server/DataService.luau, add DataService.claimDaily(player: Player, now: number?): number. Wait for the player's profile with waitProfile(player), use if now ~= nil then now else os.time(), return 0 inside the interval, otherwise set data.lastDaily, add Config.DAILY_COINS, call pushCoins(player) so leaderstats.Coins updates, and return Config.DAILY_COINS.

  4. 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 a ProfileStore.Mock session, deletes lastDaily from that in-memory profile and calls Reconcile() on the same session. It does not save and reopen an older record, so it proves the template default and Reconcile() call, not a full upgrade of a stored profile. Second, it runs claimDaily against the live profile of the player in your Play session, then puts lastDaily and your coins back.

    Grade on a disposable profile. The second part changes the real profile in memory. It runs inside pcall, so your coins and lastDaily are put back even if your claimDaily throws, and the error shows up as a failed daily_claim_error check. Pressing Stop during the test restores nothing, and ProfileStore can autosave a half-finished change. Use a staging place and a throwaway account, and check leaderstats.Coins after 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

The Course Runner prints this code when the test passes.

Choose one

A returning player saved their profile before you added lastDaily. What happens when they join your updated m14-ship server?

A returning player saved their profile before you added lastDaily. What happens when they join your updated m14-ship server?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 6 of 6

Recap

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

  1. The capstone starts from your completed m14-ship game and preserves all five rules, with Rule 4 updated for ProfileStore templates and Reconcile().
  2. Project 1 extends CombatService's raycast include list and targetTag for Swarm targets, verified live by challenges/capstone_swarm.luau.
  3. 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.

Next Capstone, part 2: cosmetic pass trail, localization and thumb targets

Link to this step · This confused me