Prompt patterns that work for Luau
Six reusable prompt shapes for building Roblox features with AI, from one-shot features to refactors, each with the wording that keeps the agent on track.
The difference between an AI that builds what you want and one that wanders is mostly how you ask. These patterns are worth saving as snippets.
1. The feature brief
Use it for anything new.
Build [feature].
What: [behavior in plain words, with real numbers]
Where: [which services or folders the code goes in]
Rules: [what the server owns; what must never be trusted]
Check: [how to playtest it and what proves it works]
2. Plan first
For anything bigger than one script, ask for a plan and approve it before any code exists.
Before writing code, give me a plan: which scripts and modules you'll
create, what each one owns, and how they talk to each other. Wait for
my OK.
3. Match what’s there
AI loves to invent a new style in every file. Point it at your existing code.
Follow the patterns in [existing module]: same structure, naming and
error handling. Don't add new libraries.
4. Explain before fixing
Here's the error: [paste the full line]. Explain the root cause before
changing anything. Then fix it at the source and playtest to prove it.
5. Small steps
Big prompts produce big messes. Chain small ones and playtest between them.
Step 1 only: make the shop UI open and close. Don't wire up buying yet.
6. Review mode
Ask a fresh agent to review, not the one that wrote the code.
Review this script as a senior Roblox developer. List bugs, exploits,
memory leaks (connections never disconnected) and performance problems,
most serious first. Don't rewrite it yet.
Words that help
- “–!strict” gets typed code that catches more bugs.
- “Server-authoritative” gets the server deciding things.
- “Don’t use deprecated APIs” avoids
wait(),spawn()anddelay(). Usetask.wait,task.spawnandtask.delay. - “Clean up connections” gets
:Disconnect()calls when objects are destroyed.