Lesson 11 of 11
Tools for your team: plugins, CLIs and code generation
Build the Yard Zone Studio toolbar plugin with undo and export validation, trace a Lune texture uploader with content hashing, and practise deterministic Luau generation.
By the end you can
- Build the Yard Zone toolbar plugin with one ChangeHistoryService undo step per action, and know how to extend it with a dockable inspector
- Share one pure-Luau data validator between the Studio plugin and CI so invalid designer edits fail immediately and never merge
- Use the Lune uploader to hash staged texture maps and track their upload ids in a local JSON manifest
- Enforce code-generation hygiene so generated manifests stay deterministic, frozen and verified by CI
Before this: Plugins pros use, and writing your own, Ecosystem tools: Lune, darklua, roblox-ts, Continuous integration: every check, blocking, Deploying with Open Cloud: staging and production
Step 1 of 9
From using tools to building them
Open scripts/gen-assets.mjs in Beacon Yard at m14-ship. Rather than asking everyone to edit XML mesh files by hand, the repository stores ID-free templates under assets/templates/ and generates assets/roblox/ and assets/materials/ from your Ids.local.luau map.
const missingMeshes = keys.filter((key) => key.endsWith("_MESH_ID") && !isSet(key));
const target = path.join(modelsOut, file);
if (missingMeshes.length > 0) {
rmSync(target, { force: true });
console.log(`skip ${name}: set ${missingMeshes.join(", ")}`);
skipped += 1;
continue;
}
writeFileSync(target, fill(text));
console.log(`model ${name} -> assets/roblox/${file}`);
written += 1;
That 120-line script saves hours of copy-paste errors every time an asset changes. A team tool does not need to be huge; it just has to remove one repetitive, error-prone task that teammates hit every day.
| In the picture | In Roblox |
|---|---|
| The jig fence | A Studio plugin that loads, adds and exports zone boxes, one Undo step per action |
| The go/no-go gauge | One shared validator run inside the plugin and again in CI |
| The batch stamper | A Lune CLI that uploads changed texture maps and tracks their ids and hashes |
Think of a carpenter's jig. Instead of measuring every cut by hand, the carpenter clamps a fence and a stop to the saw once, and every piece comes out the same size. A go/no-go gauge then checks each piece before it leaves the bench. In a game team, the plugin is the fence that makes designers' edits come out in the right shape, and the shared validator is the gauge that checks them in Studio and again in CI.
Think of it as A carpenter's jig that cuts every piece to the same spec
In Beacon Yard's scripts/gen-assets.mjs, what happens to assets/roblox/Drone.rbxmx if one of its _MESH_ID placeholders is still 0 in Ids.local.luau?
Press 1 to 4 to choose, Enter to check.
Step 2 of 9
The Yard Zone plugin designers use daily
Beacon Yard names places in the yard (Spawn, Beacon, Shop, Gate, Scrap field) with boxes in src/shared/data/zones.json. Each row is { id, label, center, size, landmark }. Asking a designer to type centres and sizes into JSON invites mistakes, so at m15-scale the team ships a small toolbar plugin instead:
local toolbar = plugin:CreateToolbar("Beacon Yard")
local loadButton = toolbar:CreateButton("Load zones", "Show zones.json as boxes in Workspace.YardZones", "")
local addButton = toolbar:CreateButton("Add zone", "Add a zone box where the camera looks", "")
local exportButton = toolbar:CreateButton("Export zones", "Validate the boxes and write zones.json text", "")
for _, button in { loadButton, addButton, exportButton } do
button.ClickableWhenViewportHidden = true
end
loadButton.Click:Connect(load)
addButton.Click:Connect(add)
exportButton.Click:Connect(export)
- Load zones clears
Workspace.YardZonesand puts one transparent box per shipped zone in it. The box's name is the zone id;LabelandLandmarkare attributes. - Add zone drops a new 16 by 8 by 16 box where the camera is looking.
- Export zones reads every box, snaps positions and sizes to half a stud, checks the rows, and only when they pass writes the JSON to
ServerStorage.YardZonesExportand to Output.
The designer moves and resizes boxes with Studio's own tools, so the plugin needs no UI of its own. toolbar:CreateButton() is all it takes1.
Optional extension: a dockable inspector
When a team wants more per-zone data, for example a spawn cap and a coin multiplier, typing attributes into Properties invites typos (SpwanCap, "1.5" as a string instead of a number). The next step up is an inspector panel built on top of the toolbar plugin. It is not in the tag; the level 3 challenge practises its validation and undo logic.
Add a toolbar button that opens a dock widget with plugin:CreateDockWidgetPluginGuiAsync(pluginGuiId, DockWidgetPluginGuiInfo.new(...)) (which supersedes the older CreateDockWidgetPluginGui)12.
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Right,
false, -- initialEnabled
false, -- override saved restore state
320, -- floating width
420, -- floating height
240, -- min width
260 -- min height
)
local widget = plugin:CreateDockWidgetPluginGuiAsync("BeaconYard_ZoneEditor", widgetInfo)
widget.Title = "Yard Zone Editor"
Keep pluginGuiId ("BeaconYard_ZoneEditor") constant across plugin updates so Studio remembers where each designer docked the panel1. Listen to Selection.SelectionChanged to load the selected zone box's attributes into the widget automatically.
Why should the first argument to plugin:CreateDockWidgetPluginGuiAsync("BeaconYard_ZoneEditor", widgetInfo) stay the same across plugin versions instead of including a version number like v2?
Press 1 to 4 to choose, Enter to check.
Step 3 of 9
Undoable edits with ChangeHistoryService
A designer clicks Load zones by mistake and wipes the boxes they spent ten minutes arranging. They press Ctrl+Z (Cmd+Z). If the plugin changed the DataModel directly, nothing undoes, or worse, Studio undoes the last part move from five minutes ago.
Every plugin edit to the DataModel must be wrapped in a ChangeHistory recordingChangeHistory recordingA transaction started by a Studio plugin so all of its edits undo and redo as a single Ctrl+Z step.Think of it as a camera roll that groups fifty tiny brush strokes into one undoable snapshot. using ChangeHistoryService:TryBeginRecording() and ChangeHistoryService:FinishRecording()34. Two edge cases from the Studio docs matter in real tools:
- One active recording per plugin. If
TryBeginRecordingreturnsnil, another recording is already open; abort instead of changing anything silently. - Always finish on error, and watch reloads. Wrap the edit body in
pcall. Commit withEnum.FinishRecordingOperation.Commiton success, or revert cleanly withEnum.FinishRecordingOperation.Cancelif anything throws. Reloading a plugin during debugging does not cancel an unfinished recording, so store the active recording identifier if needed and cancel it cleanly4.
The tagged plugin puts every action through one helper. It returns a boolean and prints the error itself, so a caller only has to check the result:
local function recorded(name: string, change: () -> ()): boolean
local recording = ChangeHistoryService:TryBeginRecording(name)
if recording == nil then
warn("[YardZone] Studio is busy recording another change; try again")
return false
end
-- xpcall, not pcall: change returns nothing, so pcall would give no
-- second value to read the error from.
local err = ""
local ok = xpcall(change, function(message: unknown)
err = tostring(message)
end)
ChangeHistoryService:FinishRecording(
recording,
if ok then Enum.FinishRecordingOperation.Commit else Enum.FinishRecordingOperation.Cancel
)
if not ok then
warn("[YardZone] " .. err)
end
return ok
Export uses that boolean. When the recording fails, it warns [YardZone] Not exported: ServerStorage.YardZonesExport was not updated and returns false, so the designer never pastes stale JSON. The cell below is the same pattern with a fake ChangeHistoryService:
Suppose a plugin calls TryBeginRecording("ApplyZone"), changes two attributes, and then throws an error BEFORE calling FinishRecording (with no pcall wrapper). What happens the next time the designer clicks the same button?
local id = ChangeHistoryService:TryBeginRecording("ApplyZone")
-- error thrown before FinishRecording!
-- next click:
local id2 = ChangeHistoryService:TryBeginRecording("ApplyZone")
print(id2)
Press 1 to 4 to choose, Enter to check.
Step 5 of 9
Lune CLI: upload assets and generate a manifest
Beacon Yard's scripts/publish-place.mjs already uploads built places with Open Cloud. You can use the same Open Cloud Assets API (POST https://apis.roblox.com/assets/v1/assets) from Lune. At m15-scale, scripts/lune/upload-assets.luau uploads staged texture maps and tracks ids in an asset manifestAsset manifestA generated file mapping logical asset names and file hashes to their uploaded Roblox asset IDs.Think of it as a parts catalogue that links every drawing number on disk to its warehouse barcode.56.
Key documented rules from the Open Cloud Assets usage guide (note the API contains beta endpoints)5:
- One asset per call, up to 20 MB, sent as
multipart/form-datawith a JSONrequestfield andfileContent. - Upload textures as
Image, notDecal, so the returned asset ID works directly in texture properties. - Audio limits: up to 7 minutes, capped at 100 uploads per month if ID-verified (10 per month if not). Audio and images cannot be updated in place; every upload creates a new asset.
- Async operations:
POSTreturns{ "path": "operations/<id>" }; pollGET https://apis.roblox.com/assets/v1/operations/<id>until"done": trueto read the newassetId.
Uploading an unchanged file can create a duplicate asset. The script checks the local hash before sending any staged texture map.
The uploader compares SHA-256 hashes against the git-ignored assets/upload-manifest.json. A dry run prints the plan without uploading or writing the manifest. After each upload the script saves its id and hash immediately, then prints sorted entries for src/shared/Ids.local.luau. Run node scripts/gen-assets.mjs to build the models from those ids.

Select a numbered pin, or a row below, to read what it marks.
Why does scripts/lune/upload-assets.luau store each staged texture map's hash in assets/upload-manifest.json and skip uploading files whose hash has not changed?
Press 1 to 4 to choose, Enter to check.
Step 6 of 9
Code-generation hygiene and choosing your stack
The challenge practises generating a Luau manifest. The tagged uploader keeps local JSON and prints ids for manual entry. Use the following practices when a project chooses to generate and track a Luau module.
- Mark it generated. Start every file with
--!strictand-- DO NOT EDIT: generated by the manifest tool. - Sort keys deterministically. Luau dictionary iteration order is not alphabetical. Sort keys before writing so adding one sound produces a one-line Git diff, not a scrambled file.
- Freeze and verify in CI. Wrap the returned table in
table.freeze(...)so runtime scripts cannot mutate IDs by mistake, and run a CI check confirming the generated file matches the manifest on disk.
Choosing your internal tooling runtime
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Roblox Studio plugin (Luau) | Runs inside Studio with Selection, DockWidgetPluginGui and ChangeHistoryService. | Visual level editors, attribute inspectors, validators designers run while editing the 3D viewport. | Cannot run headless on Linux CI; must guard recordings carefully. |
| Lune CLI (Luau) | Standalone Luau runtime (lune-org/lune, MPL-2.0, active) with built-in net, fs, serde and Roblox file libraries. | Sharing the exact same Luau validators between Studio and CI, asset uploaders, Open Cloud ops tools. | Small binary teammates install via Rokit. |
| Node.js scripts (like gen-assets.mjs) | JavaScript/TypeScript CLI scripts using built-in fetch and fs. | Teams already running Node in CI (like Beacon Yard's check-ids.mjs and publish-place.mjs). | Cannot directly require Luau game modules without duplicating validation logic. |
| darklua / code generators | AST transformer (seaofvoices/darklua, MIT, active) or custom schema-to-Luau scripts. | Generating typed registries, asset manifests or build-time transforms deterministically. | Adds a build step; always check generated outputs or verify them in CI. |
Why does the challenge's renderManifestLuau sort keys alphabetically before rendering the manifest?
Press 1 to 4 to choose, Enter to check.
Step 7 of 9
Build along: ship the Yard Zone plugin and asset CLI
In the tagged build, the plugin has a toolbar for loading, adding and exporting zone boxes. The inspector logic is practised separately in challenges/work/team_tooling.luau.
plugin.project.jsonplugins/YardZone/init.server.luausrc/shared/ZoneExport.luausrc/shared/ZoneValidator.luausrc/shared/data/zones.jsonscripts/lune/upload-assets.luau.gitignore.github/workflows/ci.yml
Build it with
rojo build plugin.project.json -o YardZone.rbxmxand copy the model into Studio's local Plugins folder. Edit box position and size in the viewport. Name each box with its zone id and use theLabelandLandmarkattributes. Run every action throughrecorded(), which returns a boolean and prints the error itself.You should see The Yard Zone toolbar loads and adds boxes under Workspace.YardZones, and Ctrl+Z undoes a toolbar change.
Call
ZoneExport.rowsandZoneExport.checkbefore exporting. The check usesContentSchema, the same schema CI uses. When the write's recording fails, warn thatServerStorage.YardZonesExportwas not updated and return false. Paste the valid JSON intosrc/shared/data/zones.jsonand runlune run scripts/check-data.You should see Export zones validates every box and writes JSON to Output and ServerStorage.YardZonesExport.
Run
lune run scripts/lune/upload-assets -- --dry-runfrom the game root. The script checks the 20 MB cap and compares hashes to the localassets/upload-manifest.json. After an actual upload it saves each returned id and prints sorted entries forIds.local.luau.You should see Dry run lists new or changed texture maps without uploading them or writing the manifest.
Step 8 of 9
Challenges
Level 2, Builder
Challenge
Test the Yard Zone plugin from your copy of the build-along in Studio, and write down what you saw in docs/plugin-qa.md. This is a self-check; no automated test grades it.
- Start from
- The game at milestone m14 (download)
Done means
- Load zones shows the six shipped zones as boxes in Workspace.YardZones, with Beacon and Shop in the landmark colour
- Add zone, then a drag that leaves part of the new box outside the Yard: Export zones refuses, names the zone and says it reaches outside the Yard, and ServerStorage.YardZonesExport is unchanged
- After moving the box back inside, Export zones prints the JSON and writes YardZonesExport, and lune run scripts/check-data passes with it pasted into zones.json
- One Ctrl+Z undoes each toolbar action on its own: an Add removes just that box, a Load brings back the boxes it cleared
Meet the criteria above, then record your own result. No test grades this check.
Level 3, Professional
Challenge
Complete challenges/work/team_tooling.luau so the shared zone validator, recording guard, upload planner and manifest renderer pass every check. Run game.ServerScriptService.RunGameTests:Invoke("team-tooling", "team-tooling-pipeline") in Studio (or test in the pure Luau runner). Written solution: challenges/solutions/team-tooling.md.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("team-tooling", "team-tooling-pipeline")in the server command bar. Copy the pass code from Output.
Done means
- For the inspector extension, validateZones enforces unique lowercase-kebab-case id, non-empty displayName, integer spawnCap 1..20, finite coinMultiplier 0.5..5.0 and positive sizeX/sizeZ
- withRecording returns false, 'recording_busy' when TryBeginRecording returns nil, commits on success and cancels on error via pcall
- planUploads rejects bytes <= 0 or > 20 MB into errors, skips unchanged hashes, queues new or changed files into upload, and sorts all three lists
- renderManifestLuau starts with --!strict, includes a DO NOT EDIT header, sorts keys alphabetically and wraps the table in table.freeze
- challenges/team-tooling.luau prints TEST PASS for all 10 checks
Step 9 of 9
Recap
Retiring the analogy
You no longer need “a carpenter's jig that cuts every piece to the same spec”. Internal plugins, validators and code generators remove manual repetition and catch schema mistakes at edit time, while designers still decide layout, pacing and feel.
Recap
- The Yard Zone toolbar plugin loads, adds and exports zone boxes; extend it with a dockable inspector built with CreateDockWidgetPluginGuiAsync and a stable pluginGuiId.
- Wrap every plugin DataModel edit in ChangeHistoryService TryBeginRecording and FinishRecording inside pcall, committing on success and cancelling on error so Ctrl+Z never breaks.
- Share one pure-Luau validator between the Studio plugin and CI (ZoneValidator over ContentSchema) so invalid data fails at edit time and cannot merge.
- The Lune uploader hashes texture maps, keeps upload records in git-ignored JSON and prints sorted id assignments. The challenge practises rendering a frozen Luau manifest.
Custom Studio plugins and CLIs is a carpenter's jig that cuts every piece to the same spec, until a jig cuts bad lumber to exact dimensions: valid zone numbers and clean IDs still produce a dull level if the layout itself is not fun.
Queued for review
- In Beacon Yard's scripts/gen-assets.mjs, what happens to assets/roblox/Drone.rbxmx if one of its _MESH_ID placeholders is still 0 in Ids.local.luau?
- Why should the first argument to plugin:CreateDockWidgetPluginGuiAsync("BeaconYard_ZoneEditor", widgetInfo) stay the same across plugin versions instead of including a version number like v2?
- Suppose a plugin calls TryBeginRecording("ApplyZone"), changes two attributes, and then throws an error BEFORE calling FinishRecording (with no pcall wrapper). What happens the next time the designer clicks the same button?
- Why does scripts/lune/upload-assets.luau store each staged texture map's hash in assets/upload-manifest.json and skip uploading files whose hash has not changed?