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

Part 2 of the Beacon Yard capstone crosses monetization, VFX, localization and React UI: add a cosmetic pass trail and localized shop entry in Studio, then fix the 44px Close button in ShopApp.luau.

Project lesson, about 55 minutes, 6 steps

By the end you can

  • Build a server-owned cosmetic pass trail in PassService that never changes WalkSpeed, and wire its localized label into ShopLabels and Strings.csv
  • Fix a real 44-pixel touch-target bug in m14-ship's React shop (ShopApp.luau) while keeping all three Controls.luau wrench bindings intact
  • Prove both changes with the Studio playtest (capstone_cosmetic_trail) and the browser-graded mobile rule check

Before this: Capstone, part 1: brief, rules and two yard extensions, UI frameworks, part 1: React-lua, elements, props and state, Localization: reaching other languages

1Why SpeedPass and a cosmetic trail follow different design rules

A game pass is bought once and owned for good, so there is no receipt to process1. The server asks MarketplaceService whether the player owns it and stores the result as a server-written player attribute.

-- A game pass is bought once and owned for good, so there is no receipt
-- to process. The server asks MarketplaceService whether the player owns
-- the pass, and writes the answer to the SpeedPass player attribute.
-- DataService.applySpeed reads that attribute and adds
-- Config.PASS_SPEED_BONUS. A client cannot set a server attribute, so a
-- client cannot give itself the pass.
Figure 1.1

Notice the design difference. Beacon Yard's SpeedPass adds Config.PASS_SPEED_BONUS (+4 walk speed) because Beacon Yard is a cooperative PvE drill where faster teammates help everyone survive. A cosmetic pass such as a spark trail must never alter WalkSpeed, health, or damage, because selling stats in competitive games breaks fairness.

Server sideRemember: The server is the referee with the only real scoreboard.

A LocalScript fires a remote claiming TrailPass = true. What should the server do?

  1. Ignore the claim; only the server checks MarketplaceService and writes the TrailPass attribute
  2. Attach the trail immediately so the player sees no delay
  3. Trust the claim for 60 seconds while checking in the background
  4. Add +4 WalkSpeed as a fallback
Answer

Ignore the claim; only the server checks MarketplaceService and writes the TrailPass attribute. Pass ownership comes from MarketplaceService on the server. The server writes the TrailPass attribute and attaches the Trail; clients only read the result.

Open this step in lesson mode · Link to this step · This confused me

2Keeping ShopLabels and Strings.csv in sync

At m14-ship, every visible word in the React shop starts in ShopLabels.luau's SOURCE table and has a matching row in src/locale/Strings.csv (which Rojo maps to LocalizationService.BeaconStrings)2. Adding a new shop item without adding its translation row leaves French and Spanish players seeing untranslated English or raw keys.

local SOURCE: { [string]: string } = {
	["shop.title"] = "Quartermaster",
	["shop.close"] = "Close",
	["shop.speed"] = "Speed",
	["shop.speed.detail"] = "faster for good",
	["shop.shield"] = "Shield",
	["shop.shield.detail"] = "blocks one drone hit",
	["shop.price"] = "{n} coins",
	["shop.item.short"] = "{price}, need {short} more",
	["shop.item.ok"] = "{price}, {detail}",
	["shop.wallet"] = "You have {n} coins",
	["shop.pack"] = "Coin Pack",
	["shop.pack.ready"] = "{n} coins",
	["shop.pass"] = "Speed Pass",
	["shop.pass.owned"] = "owned",
	["shop.pass.sale"] = "+{bonus} speed for good, Robux",
Figure 2.1
Where does it break?“The referee with the only real scoreboard” is a good picture of the server. Where does it stop being true?

It breaks here. The server is also the field itself, and it cannot see things that exist only on a client, such as a player's GUI or a LocalScript's effects.

The true model. The server runs the authoritative copy of the whole game world. Anything that matters (coins, damage, purchases) is decided there, and clients only see what it replicates to them.

The server owns the TrailPass attribute and the Trail on the character, while each client's Translator renders the label in that player's language.

A LocalScript changes the trail button's label on one player's screen. Does PassService see that label change or treat it as a pass purchase?

  1. Neither. The label is local, and pass ownership is checked on the server.
  2. Both. The server sees every GUI change as it happens.
Answer

Neither. The label is local, and pass ownership is checked on the server.. The server owns the pass state and the character effect. It does not see changes that exist only in a player's GUI.

If you add shop.trail to ShopLabels.luau but forget to add a matching row to src/locale/Strings.csv, what happens when a French player opens the shop?

  1. FormatByKey throws inside pcall, so Localize.t falls back to the English text from ShopLabels.english
  2. Roblox automatically translates the key at runtime without any table row
  3. The whole React shop fails to mount
  4. The button disappears completely
Answer

FormatByKey throws inside pcall, so Localize.t falls back to the English text from ShopLabels.english. Localize.t wraps Translator:FormatByKey in pcall and falls back to ShopLabels.english on a miss. The game does not crash, but French players get English instead of their language.

Open this step in lesson mode · Link to this step · This confused me

3Build and grade Project 3 in Studio

Extend your m14-ship game in three files:

  1. In src/server/PassService.luau, add PassService.hasTrail(player: Player): boolean (reads player:GetAttribute("TrailPass") == true) and PassService.setTrail(player: Player, owned: boolean). Write the "TrailPass" attribute, create two Attachment instances on the character's HumanoidRootPart (Vector3.new(0, 1, 0) and Vector3.new(0, -1, 0)), attach a Trail named "PassTrail" between them, toggle trail.Enabled = owned, and leave WalkSpeed untouched. Also re-apply the trail on player.CharacterAdded if PassService.hasTrail(player) is true.
  2. In src/shared/ShopLabels.luau, add ["shop.trail"] = "Spark Trail" to SOURCE.
  3. In src/locale/Strings.csv, add a shop.trail row with en, fr and es translations.
  4. Press Play and run game.ServerScriptService.RunGameTests:Invoke("capstone_cosmetic_trail", "capstone-cosmetic-trail") in the server command bar.

Level 3, Professional

Challenge

Extend PassService.luau, ShopLabels.luau and Strings.csv in your m14-ship game, then run challenges/capstone_cosmetic_trail.luau in Studio. Solution: challenges/solutions/capstone-trail-ui.md.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("capstone_cosmetic_trail", "capstone-cosmetic-trail") in the server command bar. Copy the pass code from Output.

Done means

  • PassService.setTrail(player, true) sets the TrailPass attribute to true and attaches an enabled Trail named PassTrail with both attachments
  • Calling DataService.applySpeed(player) with TrailPass enabled leaves Humanoid.WalkSpeed identical to before
  • PassService.setTrail(player, false) sets TrailPass to false and disables or removes PassTrail
  • ShopLabels.source()['shop.trail'] is non-empty and LocalizationService.BeaconStrings has a shop.trail row with en, fr and es entries
  • challenges/capstone_cosmetic_trail.luau prints TEST PASS for all five checks

Hints

  1. Parent both Attachments and the Trail named PassTrail under character:FindFirstChild("HumanoidRootPart").
  2. Do not touch DataService.applySpeed; the test calls it specifically to prove your trail adds zero speed bonus.
  3. Match the exact 7-column CSV format in src/locale/Strings.csv: Key,Source,Context,Example,en,fr,es.

A player owns TrailPass, dies during a drill, and respawns with a brand-new Character model. Why does PassService need a CharacterAdded listener?

  1. The old HumanoidRootPart and its PassTrail were destroyed with the old character, so the trail must be attached to the new character
  2. Player attributes reset to nil every time a character dies
  3. MarketplaceService revokes game passes on death
  4. Trails only render on the first character in a server
Answer

The old HumanoidRootPart and its PassTrail were destroyed with the old character, so the trail must be attached to the new character. The TrailPass attribute stays on the Player across respawns, but the old Character (and the Trail inside it) is destroyed. Listening to CharacterAdded re-attaches PassTrail whenever the player respawns.

Open this step in lesson mode · Link to this step · This confused me

4Project 4: spot the 44px touch bug in m14-ship's React shop

Touch targets on phones need at least 48 by 48 pixels so a thumb does not miss or hit the wrong row3. Now inspect src/client/ShopApp.luau at m14-ship: each ShopButton is 84 pixels tall, but look at the Close button at the bottom of the panel.

		Close = e("TextButton", {
			Size = UDim2.new(1, 0, 0, 44),
Figure 4.1

Close is 44 pixels tall: four pixels below the 48-pixel rule. Meanwhile, src/client/Controls.luau binds the wrench across keyboard (F), gamepad (ButtonR2) and a touch button (touchButton = true). Any UI or input tweak must preserve all three devices.

	WrenchSwing = {
		title = "Swing",
		inputs = { Enum.KeyCode.F, Enum.KeyCode.ButtonR2 },
		touchButton = true,
Figure 4.2

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
React-lua (m09-react-shop onward)Declarative components and hooks installed through Wally; state changes re-render only the changed Instances.Complex menus, shops, inventories and multi-state HUDs like Beacon Yard's ShopApp.Extra package dependency and a mental shift from imperative Instance.new code.
Fusion or VideReactive state-graph UI libraries popular in Roblox studios.Teams that prefer fine-grained reactive values over React's render tree and hooks.Smaller ecosystem than React-lua and fewer cross-platform React developers.
Plain Instances (m07-feel ShopGui)Direct Instance.new and property mutations in Luau.Tiny one-off prompts or learning how ScreenGui and layouts work.State updates scatter across callbacks and become bug-prone as screens grow.

In m14-ship's ShopApp.luau, how many pixels too short is the 44px Close button compared to the 48px touch-target minimum?

Answer

4 pixels. 48 minus 44 is 4 pixels. Raising Close from 44 to 48 (and the panel height from 636 to 640 so nothing clips) brings every shop button to 48px or taller.

Which three input devices does Controls.luau bind under the single action name WrenchSwing at m14-ship?

  1. Keyboard F, gamepad ButtonR2, and an on-screen touch button
  2. Mouse left-click only
  3. Keyboard E, gamepad ButtonX, and no touch button
  4. Keyboard F and gamepad ButtonB only
Answer

Keyboard F, gamepad ButtonR2, and an on-screen touch button. WrenchSwing binds Enum.KeyCode.F, Enum.KeyCode.ButtonR2, and touchButton = true in one ContextActionService:BindAction call.

Open this step in lesson mode · Link to this step · This confused me

5Fix the rule cell and ShopApp.luau

Fix thumbOk and wrenchBindings in the browser cell below to grade Project 4. To grade in Studio instead, copy your rules into challenges/work/capstone_mobile.luau, press Play and run game.ServerScriptService.RunGameTests:Invoke("capstone_mobile", "capstone-mobile") in the server command bar. Then raise Close's height from 44 to 48 and the panel's Size from 636 to 640 in your own src/client/ShopApp.luau. Neither grader opens ShopApp.luau. They only test the two helper rules, so a pass code does not prove the shop changed. You check the shop yourself: press Play, open the shop on a phone-sized emulator and confirm every button is at least 48 pixels tall and nothing clips.

Luau
-- Fix both functions to match the 48x48 thumb rule and Controls.luau bindings.
local function thumbOk(width, height)
	return width >= 10 and height >= 10
end
 
local function wrenchBindings()
	return { "F" }
end
Figure 5.1. Run it in the lesson view or in the Studio command bar. The lesson view checks it with tests.

Level 2, Builder

Challenge

Pass the code cell above (or challenges/capstone_mobile.luau in Studio), then update Close in src/client/ShopApp.luau and check it by eye. The pass code covers the first two criteria only. Solution: challenges/solutions/capstone-trail-ui.md.

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.
Or grade it in Studio
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("capstone_mobile", "capstone-mobile") in the server command bar. Copy the pass code from Output.

Done means

  • thumbOk returns true only when both width and height are at least 48
  • wrenchBindings returns Touch, F and ButtonR2
  • Manual check, not covered by the pass code: in your own src/client/ShopApp.luau, Close has height 48 and the panel height is 640 so nothing clips

Hints

  1. Check width >= 48 and height >= 48.
  2. Return { "Touch", "F", "ButtonR2" }.
  3. Look around line 330 and line 404 of src/client/ShopApp.luau for Size = UDim2.fromOffset(400, 636) and UDim2.new(1, 0, 0, 44).

After raising Close's height from 44 to 48 inside ShopApp.luau, why do we also raise the parent Frame's height from 636 to 640?

  1. So the UIListLayout keeps the exact same padding and bottom margin without overflowing the fixed-height panel
  2. Because React-lua refuses to render a Frame shorter than 640 pixels
  3. Because UIScale doubles every button height
  4. So CloseShop gains a touch button
Answer

So the UIListLayout keeps the exact same padding and bottom margin without overflowing the fixed-height panel. The panel has a fixed vertical pixel height sized to its title, wallet, five buttons, padding and gaps. Growing Close by 4 pixels means growing the container by 4 pixels too.

Open this step in lesson mode · Link to this step · This confused me

6Recap

Recap

  1. Project 3 adds a server-owned TrailPass attribute and cosmetic PassTrail in PassService without altering WalkSpeed, plus en/fr/es entries for shop.trail in ShopLabels and Strings.csv.
  2. Project 4 catches and fixes a real 44px Close button in m14-ship's ShopApp.luau and verifies the 48px touch rule and three-device wrench bindings.

The server is the referee with the only real scoreboard, until the server is also the field itself, and it cannot see things that exist only on a client, such as a player's GUI or a LocalScript's effects.

Next Capstone, part 3: multi-product receipts and party matchmaking

Open this step in lesson mode · Link to this step · This confused me