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.

Project lesson, about 70 minutes, 9 steps

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.

Stored dataCustom Studio plugins and CLIs is a carpenter's jig that cuts every piece to the same spec.
In the pictureIn Roblox
The jig fenceA Studio plugin that loads, adds and exports zone boxes, one Undo step per action
The go/no-go gaugeOne shared validator run inside the plugin and again in CI
The batch stamperA Lune CLI that uploads changed texture maps and tracks their ids and hashes

See the whole analogy cast

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

Choose one

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?

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.

Link to this step · This confused me

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.YardZones and puts one transparent box per shipped zone in it. The box's name is the zone id; Label and Landmark are 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.YardZonesExport and 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.

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

One validator for Studio and CITwo inputs on the left, the Yard Zone plugin's Export and the Lune data check in CI, both flow into one shared ZoneValidator module in the middle, which runs the ContentSchema zone rules and feeds valid zone data on the right.validYard Zone PluginExport buttonGitHub CILune checkZoneValidatorContentSchema zonesZone Datasafe to ship
The plugin and CI call the same ZoneValidator, which runs ContentSchema's zone rules.
Choose one

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?

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.

Link to this step · This confused me

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:

  1. One active recording per plugin. If TryBeginRecording returns nil, another recording is already open; abort instead of changing anything silently.
  2. Always finish on error, and watch reloads. Wrap the edit body in pcall. Commit with Enum.FinishRecordingOperation.Commit on success, or revert cleanly with Enum.FinishRecordingOperation.Cancel if 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:

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

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

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 4 of 9

One validator in the plugin and in CI

If the plugin validates zones with one set of rules and CI validates them with another, the two drift apart within a month. Beacon Yard keeps the rules in one pure-Luau place. ZoneExport.check calls ZoneValidator.validateZones, which runs ContentSchema's zone rules: every row has a non-empty id that is unique in the file, a Yard row exists, every size is above 0, and every zone sits inside the Yard. lune run scripts/check-data runs the same schema in CI before a pull request can merge.

Here is the last rule with a bug in it. It checks only each zone's centre, so a big box near the edge slips through. Fix inside so all four tests pass:

Luau
Ctrl Enter runs the cell. Checked by tests

Level 1, Apprentice

Challenge

Fix inside in the yard-contain-fix cell. ContentSchema adds the same tiny tolerance, 1e-6, so a box that sits exactly on the edge is not refused by rounding.

Start from
The game at milestone m14 (download)
Check it here
Run the code cell; the challenge completes when it passes. No Studio needed.

Done means

  • inside adds half the zone's size to the distance from the Yard's centre on every axis
  • A zone exactly on the Yard's edge still fits
  • All four assertions in yard-contain-fix pass

The inspector extension needs more rules, because it adds fields. This is the validator the level 3 challenge asks for, run on a good and a bad zone:

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

Stored dataRemember: Custom Studio plugins and CLIs is a carpenter's jig that cuts every piece to the same spec.

The toolbar is the fence: every box it adds or loads comes out with a name, a Label and a Landmark attribute, in one undo step. Export is the gauge: nothing reaches zones.json until the rows pass, and CI runs the same gauge again.

Where does it break?“A carpenter's jig that cuts every piece to the same spec” is a good picture of custom studio plugins and clis. Where does it stop being true?

It breaks here. 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.

The true model. Internal plugins, validators and code generators remove manual repetition and catch schema mistakes at edit time, while designers still decide layout, pacing and feel.

The jig stops empty or duplicate ids, missing sizes and boxes outside the Yard at edit time. It cannot judge whether the Scrap field is a fun place to fight or whether the Beacon is easy to spot from spawn. Tools enforce structure; playtesting evaluates design.

Choose one

A designer adds a zone EastAlley with Add zone, drags it into place and clicks Export zones. The plugin and CI's data check both pass. What can the validator NOT guarantee?

A designer adds a zone EastAlley with Add zone, drags it into place and clicks Export zones. The plugin and CI's data check both pass. What can the validator NOT guarantee?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

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-data with a JSON request field and fileContent.
  • Upload textures as Image, not Decal, 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: POST returns { "path": "operations/<id>" }; poll GET https://apis.roblox.com/assets/v1/operations/<id> until "done": true to read the new assetId.

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.

Roblox Studio
Roblox Studio showing the Yard Zone toolbar, zone boxes in the viewport and the validated JSON in Output.

Select a numbered pin, or a row below, to read what it marks.

Choose one

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?

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.

Link to this step · This confused me

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.

  1. Mark it generated. Start every file with --!strict and -- DO NOT EDIT: generated by the manifest tool.
  2. 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.
  3. 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

OptionWhat it isWhen pros pick itTrade-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 generatorsAST 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.
Choose one

Why does the challenge's renderManifestLuau sort keys alphabetically before rendering the manifest?

Why does the challenge's renderManifestLuau sort keys alphabetically before rendering the manifest?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

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.

Build along

m14-ship to m15-scale

  • plugin.project.json
  • plugins/YardZone/init.server.luau
  • src/shared/ZoneExport.luau
  • src/shared/ZoneValidator.luau
  • src/shared/data/zones.json
  • scripts/lune/upload-assets.luau
  • .gitignore
  • .github/workflows/ci.yml
  1. Build it with rojo build plugin.project.json -o YardZone.rbxmx and 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 the Label and Landmark attributes. Run every action through recorded(), 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.

  2. Call ZoneExport.rows and ZoneExport.check before exporting. The check uses ContentSchema, the same schema CI uses. When the write's recording fails, warn that ServerStorage.YardZonesExport was not updated and return false. Paste the valid JSON into src/shared/data/zones.json and run lune run scripts/check-data.

    You should see Export zones validates every box and writes JSON to Output and ServerStorage.YardZonesExport.

  3. Run lune run scripts/lune/upload-assets -- --dry-run from the game root. The script checks the 20 MB cap and compares hashes to the local assets/upload-manifest.json. After an actual upload it saves each returned id and prints sorted entries for Ids.local.luau.

    You should see Dry run lists new or changed texture maps without uploading them or writing the manifest.

Link to this step · This confused me

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

The Course Runner prints this code when the test passes.

Link to this step · This confused me

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

  1. The Yard Zone toolbar plugin loads, adds and exports zone boxes; extend it with a dockable inspector built with CreateDockWidgetPluginGuiAsync and a stable pluginGuiId.
  2. Wrap every plugin DataModel edit in ChangeHistoryService TryBeginRecording and FinishRecording inside pcall, committing on success and cancelling on error so Ctrl+Z never breaks.
  3. Share one pure-Luau validator between the Studio plugin and CI (ZoneValidator over ContentSchema) so invalid data fails at edit time and cannot merge.
  4. 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.

Next Pillars and loops: moment, session, meta

Link to this step · This confused me