# How to reduce AI token usage on a Roblox project

> Where the tokens go when an AI coding tool works on a Roblox game, and six ways to use fewer of them, with measured numbers from a 115,580-line project.

Published 1 December 2026, by RoPhons. https://rophons.com/guides/reduce-ai-token-usage-roblox/

**Short answer:** Most tokens in an AI coding session on a Roblox game go to context that is sent again on every request, such as tool definitions, whole scripts and earlier tool results. Keep your scripts as files on disk so the AI can search them and read only what it needs, connect only the MCP servers a task uses, give the AI a short project guide, and start a new session for each unrelated task. In our benchmark of five script tasks, working on synced files instead of through Roblox's Studio MCP alone used 67% fewer tokens.

## Where the tokens go

An AI coding agent such as Claude Code, Cursor or a VS Code agent does its work in turns. Each turn is one request to the model, and each request carries:

- **A fixed part:** the agent's own instructions, the definitions of every tool it may call, including every tool of every connected MCP server, and project guides such as `CLAUDE.md`.
- **The conversation so far:** your prompt, every file or script it has read and every tool result, all sent again on the next turn.
- **The new output:** what the model writes this turn.

The fixed part is paid on every turn, so it adds up fast. In [our benchmark](https://rophons.com/benchmarks/studio-mcp-tokens/), a request with Roblox's Studio MCP connected carried 23,094 tokens before any work, against 6,883 with only file tools. A five-turn task pays that difference five times.

The second big cost is reading. A script read in full stays in the conversation until the session ends. The largest script in our test project was 4,050 lines; reading it whole to change one constant is the expensive way to do it.

## Six ways to use fewer tokens

1. **Work on scripts as files.** When scripts are kept on disk by a sync tool, the agent uses its own file tools: a text search returns only the matching lines, and it can read a file by line range. In our test, changing one value in a 4,050-line script took 21,851 tokens on files against 95,049 through the Studio MCP alone.
2. **Search before reading.** Ask for the call sites, the definition or the config value, not "look at the codebase". Agents follow the wording of a task: "find where X is set" leads to a search, "review X" leads to reading.
3. **Connect only the MCP servers a task needs.** Every connected server adds its tool definitions to every request. Loading the Studio MCP next to file tools used 145% more tokens than file tools alone in our test, even though the agent mostly used the files.
4. **Give the agent a short map of the project.** A `CLAUDE.md` or `AGENTS.md` file that says where the server scripts, client scripts and shared modules live saves the agent from exploring the tree each session. Keep it short: it is part of the fixed cost too.
5. **Start a new session for each unrelated task.** Everything read in the last task is still sent with every request in this one. In Claude Code, `/clear` starts over; `/compact` replaces the history with a summary.
6. **Ask for targeted edits.** "Change `ROW_PAD_X` to 16 in Widgets" costs less than "tidy up the padding in Widgets", which invites reading and rewriting.

## What the difference looks like

Median total tokens per task, three runs each, Claude Sonnet 5.5 in Claude Code on a game of 220 scripts. All runs passed.

| Task | Studio MCP alone | Synced files | Change |
|---|--:|--:|--:|
| Find every script that calls a function | 71,377 | 15,412 | −78% |
| Change one value in a 4,050-line script | 95,049 | 21,851 | −77% |
| Rename a function across 7 scripts | 96,890 | 57,593 | −41% |
| Add a new module and use it | 183,392 | 46,783 | −74% |
| Explain a system and name its scripts | 250,679 | 90,826 | −64% |

The [full benchmark](https://rophons.com/benchmarks/studio-mcp-tokens/) has the method, the third setup with both loaded, costs, times and every anomaly.

## Where this does not help

- **Things only Studio can do.** Playtesting, reading output from a running game, screenshots and editing instances that are not scripts need the Studio MCP or Studio itself.
- **Many small edits across many files.** The seven-file rename used fewer tokens on files, but more turns, more time and more money, because files are edited one at a time.
- **Fewer tokens is not the same as a smaller bill.** Many of the tokens saved are cache reads, which are cheap. See [how to lower Claude Code costs on a Roblox game](https://rophons.com/guides/lower-claude-code-costs-roblox/).

## How RoPhons fits in

RoPhons is a Windows app that keeps each place of a Roblox game in sync with a folder of script files, so AI tools can work on files. It also writes an `AGENTS.md` and `CLAUDE.md` guide into each place's folder, and its MCP server gives the agent the game's places, sync state, logs and notes through a small set of tools. It does not replace the Studio MCP for playtesting or for instances that are not scripts.

## Questions

### Do I need RoPhons to work on Roblox scripts as files?

No. Any tool that keeps scripts on disk gives an AI agent files to search and edit; Rojo is a widely used open-source one. RoPhons adds the management around it: a sync per place that restarts itself, a Studio plugin that pairs without ports, guides for AI tools and per-game notes.

### Does this apply to Cursor and VS Code, or only to Claude Code?

The mechanism applies to any agent that sends tool definitions and conversation history with each request, which is how agent tools work. Our numbers come from Claude Code with Claude Sonnet 5.5 only; other tools and models will give other numbers.

### How do I see how many tokens a session uses?

In Claude Code, `/context` shows what the current context is made of, including how much MCP tool definitions take. In headless mode, `claude -p --output-format json` returns the token counts and an estimated cost for the run.
