UI Designer
On this page
Vibe-code it with Claude or ChatGPT
You don't have to write the game code yourself. Give an AI your two hook scripts and a clear prompt, and it can fill in the handlers: shops, rewards, teleports, saving. This page shows what to paste, a prompt that keeps the AI on the rails, and how to check the result in Studio.
What you need#
- Your UI installed in a place (Getting started). Press Play once to see it works.
- The two hook scripts,
<Name>_UIHooksand<Name>_ServerHooks. Every export includes them (The two hook scripts). Add your real product and game pass ids first, so the scripts contain them. - A prompt: the Copy AI prompt button on your design, or the template below.
The hook scripts are what make this work: they list every button, event, product and setting of your UI, with safe empty handlers and a checklist of what's missing. The AI fills in blanks instead of guessing how the UI works.
The Copy AI prompt button#
Open your design on the UI Designer. In the Make it work in your game box, press Copy AI prompt. It copies a prompt written for that design:
- where the UI's pieces are in your place, and that the logic goes in the two hook scripts;
- its screens, currencies, the events the UI fires and the Remote actions the server receives;
- the products and passes that still need ids, the things the server has to give, and the settings only code can apply;
- the Extras already in the game, so the AI doesn't write them again;
- the BloxUI calls it may use and the safety rules (the server decides, never give twice, return true only after giving);
- once the design is exported, both scripts as they were exported.
Paste it into Claude or ChatGPT, replace the line What I want the game to do with what you want, and send. If you've already changed the scripts in Studio, paste your versions instead of the ones in the prompt: it says so itself. For a UI without the button, use the template below.
A prompt template#
Copy it, replace <Name> with your UI's name, describe one feature, and paste your scripts at the bottom.
You are helping me script my Roblox game in Luau. Its UI was made with the BloxMaps UI Designer and runs on the BloxUI runtime. Follow these rules:
1. The UI builds itself when the game runs, from its blueprint (ReplicatedStorage.BloxUI_Blueprints.<Name>). Never create, clone or edit GUI instances for it and never touch PlayerGui. Change what it does only through the two hook scripts below.
2. <Name>_UIHooks is a LocalScript in StarterPlayerScripts. <Name>_ServerHooks is a Script in ServerScriptService. Keep their structure: fill in the handlers, keep every check, don't rename anything, and keep UI.Server.start({...}) as the LAST line of ServerHooks.
3. Client API: local ui = UI.Blueprint.waitFor("<Name>", 30). ui:on(eventName, function(context) end) gives context.id, context.screen and context.payload. ui:open(id), ui:close(id), ui:toggle(id). ui.currencies.<id> is a Fusion value (read it with UI.peek). ui:give(id, amount, fromPart) only plays the fly-in for leaderstat/attribute currencies. ui:notify(text). ui:state(sectionId, key, default):set(value) sets what a section shows: Daily "claimed", Quests "<questId>.progress" and "<questId>.claimed", Pass "progress".
4. Server API: UI.Server.on(name, function(player, elementId, payload) end) for Remote actions. UI.Server.grant(player, currencyId, amount), UI.Server.getCurrency, UI.Server.setCurrency. UI.Server.onReceipt(productId, fn), onCaseDrop, onSpinPrize and onReward must return true ONLY after the item was really given, and must never give twice for the same claim id (PurchaseId / claimId). UI.Server.canBuy, UI.Server.setIndexOwned, UI.Server.getSettings.
5. Security: the client only asks, the server decides. Every reward, purchase, currency change, unlock and teleport happens on the server after checking the player's own data. Check the type, length and range of every value a client sends. Never trust a price, amount or item id from a client.
6. BloxUI already answers MarketplaceService.ProcessReceipt. Do not write another ProcessReceipt: use UI.Server.onReceipt for products that need code.
7. UI.Server already saves the UI's currencies, upgrades and reward claims. Save anything new (levels, inventory, quest progress) with DataStoreService, inside pcall, keyed by player.UserId.
8. Use task.wait / task.spawn / task.delay, not wait / spawn / delay.
9. If my place has ServerScriptService.BloxGame (BloxMaps Extras: ready-made systems like saving, Robux products, daily rewards), don't write those systems again. Their settings are in BloxGame.GameSettings.
10. Reply with complete scripts I can paste over the old ones, and tell me exactly where any new instance (a RemoteEvent, a Part) must go.
What I want:
<describe your game and ONE feature, e.g. "Hatching an egg in the Eggs shop gives a random pet from its pool and adds it to the My Pets screen. Pets are saved.">
My two hook scripts:
-- <Name>_UIHooks
<paste the whole script here>
-- <Name>_ServerHooks
<paste the whole script here>What to paste, in order#
- The prompt (from the button or the template).
- Only if the prompt doesn't already contain them (the template, or scripts you changed in Studio): the whole
<Name>_UIHooks: open it in Studio, press Ctrl+A, Ctrl+C. - The whole
<Name>_ServerHooks, the same way. - Any of your own scripts the feature touches (your data script, your pet system).
- Later, when something breaks: the exact red error lines from Studio's Output window.
Then paste the scripts it returns over the old ones (select all in the script, paste). Keep the names: the UI finds nothing by itself, but the scripts find the UI by its name.
Good requests#
- "When a player touches a coin in
workspace.Coins, give 10 Coins on the server, play the fly-in from the coin, and respawn the coin after 30 seconds." - "Make the Rebirth button work: it costs 10,000 Coins, resets Coins to 0, adds 1 to a saved Rebirths value, and every rebirth gives +10% coins."
- "The Daily rewards window should really work: one claim every 20 hours, the streak resets after 48 hours, rewards come from the server and are saved."
- "Selling pets: the Sell button in My Pets sells the selected pet for its value. Check on the server that the player owns it."
Test it in Studio#
- Press Play (F5) and open the Output window. Red lines are errors; lines starting with
[BloxUI]come from the UI and usually say what's wrong. - Click through every button you changed. Watch the counters: server-owned currencies only change when the server changes them.
- Test purchases: in Studio, buying a developer product shows a test purchase prompt and charges nothing, and
ProcessReceiptruns like in the live game. The products must exist on your published experience (Creator Dashboard > Monetization). If a game pass perk doesn't turn on after a test purchase in Studio, check it in the live game: BloxUI only trusts Roblox's ownership check. - Test saving: DataStores need a published game and Game Settings > Security > Enable Studio Access to API Services. Stop, press Play again, and check your coins came back.
- Test with two players for anything between players (trading, gifts): Studio's Test tab can start a local server with several clients.
- Test on a phone screen with Studio's device emulator. BloxUI lays itself out for phones by itself.
Common mistakes#
| Mistake | What goes wrong | Tell the AI |
|---|---|---|
| It gives coins or items in the LocalScript | Nothing is saved, and exploiters can give themselves anything | "Do every reward on the server, in ServerHooks." |
It writes its own MarketplaceService.ProcessReceipt | BloxUI's purchases stop being delivered (only one ProcessReceipt can exist) | "Use UI.Server.onReceipt, don't set ProcessReceipt." |
| A delivery hook returns true before giving, or gives on every retry | Paid purchases that deliver nothing, or double grants | "Return true only after giving; skip claim ids already given." |
It moves UI.Server.start to the top | Handlers registered after it can miss the first players and purchases | "Keep UI.Server.start as the last line." |
It edits PlayerGui or makes its own ScreenGui for the shop | Changes vanish or fight the UI | "Use ui:open, ui:on and the blueprint; don't touch PlayerGui." |
| It trusts what the client sends ("buy item X for price Y") | Free items for exploiters | "Look the price up on the server from its own table." |
It renames the scripts or the UI name in waitFor | The UI hooks time out: "wasn't built in 30 s" | "Keep the names from my scripts." |
| It uses your design's placeholder ids | "Not for sale yet!", or a Roblox error in the prompt | Add the real ids to the design first, then make the hooks again. |
It invents functions (ui:setCoins, UI.Server.buy) | "attempt to call a nil value" in Output | Paste the error, and point it at the quick reference. |