# AI Luau scripting that understands your game
Luafox works on the scripts already in your place. It reads how your game is put together, changes only what the request needs, shows every edit as a diff, and checks its code before it says it is done.

Luafox is an AI scripting agent for Roblox Studio. It reads the Luau scripts in the place you have open, writes new ones and edits existing ones with exact, reviewable changes, then checks every script it touched for errors across the whole project. Every change is one undo step in Studio, so **Ctrl+Z** takes it back.

## How Luafox writes Luau scripts in your game
A chat window only sees what you paste into it. Luafox works through a small plugin in Studio, so it can look at the game itself: the Explorer tree, the properties of an instance, and the source of any script. Before it writes anything non-trivial it looks at how your game already does it, so new code uses your module names, your folders and your remotes instead of inventing parallel ones.

- **It looks first.** It reads the parts of the Explorer tree that matter, searches every script for the names involved, and reads the scripts it is about to change.
- **It writes small, exact edits.** Changes to an existing script are find-and-replace edits or line-range edits, not a rewrite of the whole file. New scripts are created in the right place: a script in StarterPlayerScripts becomes a LocalScript, one in ReplicatedStorage a ModuleScript, and missing folders are created.
- **It shows you the diff.** Each edit appears in the chat as a script card you can open to see exactly what changed.
- **It checks what it wrote.** Every script it touched goes through Luafox’s Luau checker, and it fixes what the checker finds before moving on.
- **It tests when the change runs.** When a change affects how the game plays, it starts a playtest and reads the Output, or plays the game with a scripted test. See [AI playtesting](https://luafox.uk/features/ai-playtesting).

Some things you might ask for:

YouAdd a sprint with a stamina bar that drains while running and refills after two seconds of walking.

YouThe shop gives the item even when the player has no coins. Find out why and fix it on the server.

YouSplit the combat script into a module for damage and one for hit detection, and update everything that requires it.

## What it checks before you press Play
Luafox has its own Luau checker, which runs on a single script (`lint_script`) or on the whole place at once (`check_scripts`). The project-wide check catches mistakes that only show up when you look at several scripts together:

- **A require that finds nothing:** a path to a module that does not exist, usually after something was renamed or moved.
- **A module member that is not exported:** code that calls `Shop.buy` when the module only returns `Shop.purchase`.
- **A remote fired but never handled:** a RemoteEvent the client fires with no `OnServerEvent` listening on the server.
- **A circular require:** two modules that require each other, which fails at runtime.
- **Single-script problems:** undefined variables that read as nil, unused requires, deprecated or retired Roblox APIs, lowercase method names, and `require(assetId)`, which runs code you have not read.

The checker reads code; it does not run it. Logic errors that only appear while the game runs are what playtests are for.

## The Luau it writes
Luafox follows the conventions experienced Roblox developers expect, so the code is easy to keep:

- `task.wait`, `task.spawn` and `task.delay`, not the old `wait` and `spawn`.
- Server and client code kept apart: game state and rewards on the server, input and UI on the client.
- Every RemoteEvent and RemoteFunction validated on the server, because a client can send anything.
- No deprecated APIs, and small changes over rewrites, so your own code stays recognisable.

It also has a library of 21 Roblox and Luau skills, which it loads only when a task needs one: luau fundamentals, remotes & security, datastores, ui, animation, npcs & pathfinding, physics & movement, combat & abilities and more. Every example script in them passes the same checker. You can import skills you wrote for other AI tools too; see [MCP servers and skills](https://luafox.uk/features/roblox-studio-mcp).

## Fixing errors from the Output
Ask it to fix the error in Output and it reads the Output log itself, finds the script and line, and forms one explanation from the evidence before it changes anything. It makes the smallest fix that addresses the cause, then checks again. After two failed fixes it re-reads the code and questions its own assumption instead of piling on more changes. The full method is in the guide[how to fix Roblox script errors with AI](https://luafox.uk/guides/fix-roblox-script-errors-with-ai).

For an API it is unsure of, Luafox can search the web, read the Roblox documentation and DevForum posts, and say which sources it used, instead of guessing at a function that may have changed. On paid plans you can also attach a video of the bug: Luafox takes frames from it and notes where the picture changes.

## Big systems across many scripts
For a system that spans many scripts, such as an inventory with saving, a shop and its UI, Luafox can plan the parts, post the names and function signatures the scripts must agree on, and hand separate scripts to helper agents that work at the same time (up to eight at once). A reviewer helper can then read the result with fresh eyes. Helpers cost extra model time, so it uses them for genuinely large jobs and does routine work itself.

## You stay in control

- **Undo:** Every change is one undo step in Studio. A batch of changes that fails partway is rolled back, not left half done.

- **Ask first:** Turn on “Ask before risky actions” and it asks before running Luau, deleting, uploading or running a scripted playtest.

- **Studio switches:** The plugin has its own read-only mode and switches for running Luau and deleting.

- **Your code:** Script edits go through the script tools, never through hidden Luau, so every change is visible as a diff.

More on how your computer and game are protected is on the [security page](https://luafox.uk/security).

## Questions about AI Luau scripting

### Can it work on a game I already started?
Yes. That is what it is built for: it reads the scripts that are there and changes them in place, using your existing modules and remotes.

### Do I need to know Luau?
No. You can describe the behaviour you want in plain English. Knowing some Luau helps you review the diffs and learn from them.

### Is it a Luau code generator?
It generates Luau, but it also places it in the right scripts, edits what exists, checks it against the rest of your game and tests it. A generator hands you a snippet to paste; Luafox does the work in Studio.

### Which model writes the best Roblox code?
It depends on the task and budget. Sonnet 5.5 is a strong default; for hard, long jobs a deeper model helps. See [choosing a model](https://luafox.uk/features/ai-models).

## Related

- [AI playtesting Luafox playtests what it builds in Roblox Studio: it plays as a player, checks the outcome, reads server and client errors, and fixes what fails.](https://luafox.uk/features/ai-playtesting)
- [Fix script errors with AI A practical way to fix Roblox Studio Output errors with an AI agent: read the exact error and line, test one cause at a time, and prove the fix in a playtest.](https://luafox.uk/guides/fix-roblox-script-errors-with-ai)
- [Claude, ChatGPT and more Use Claude, GPT, Gemini, Kimi or DeepSeek in Roblox Studio with Luafox: pay with credits, bring your own API key, or use your ChatGPT or Claude plan.](https://luafox.uk/features/ai-models)
- [Luafox vs Roblox Assistant How Luafox compares with Roblox Studio’s built-in Assistant: what both do, where each is stronger, models, limits and pricing, as of November 2026.](https://luafox.uk/compare/roblox-assistant)
- [Pricing Luafox is free to start with 20 credits, and the same models cost up to 12x less than list price. See what credits buy and what each plan includes.](https://luafox.uk/pricing)
