How to Use Claude Code with Roblox Studio (Complete Guide)
Set up Claude Code for Roblox game development. Learn how to connect Claude's AI to Roblox Studio, write Luau scripts, and build games faster with AI.
Claude Code Can Build Your Roblox Game — If You Set It Up Right
Here's what happens when you run Claude Code in a Roblox project without any setup: it writes JavaScript. Or Lua 5.1. Or some weird hybrid that looks right but crashes the moment you hit Play in Studio.
That's not Claude being dumb. It just doesn't know you're building a Roblox game. And honestly, why would it? Roblox uses Luau — a language that maybe 2% of developers outside the platform have even heard of.
But give Claude the right context, and it goes from useless to genuinely scary good. I've watched it generate a full DataStore system with retry logic, proper error handling, and session locking in about 40 seconds. The kind of thing that would take me an afternoon to write and debug.
The trick is a single file called CLAUDE.md.
Quick Setup with Roxlit
If you don't want to deal with any of the manual steps below:
npx roxlit setup
That's it. One command. It installs Rojo, configures the Studio plugin, creates your project structure, and — most importantly — generates the CLAUDE.md file that makes Claude actually understand Roblox. You can skip straight to building.
But if you want to understand what's happening under the hood (or you just like doing things yourself), keep reading.
Why Claude Doesn't Know Roblox By Default
Claude Code is Anthropic's terminal-based AI. Unlike ChatGPT or other chatbots, it runs directly in your project folder. It reads your files, writes code, runs commands. Think of it as a developer sitting next to you who can type really, really fast.
The problem? Out of the box, it has no idea about:
- Luau syntax — it'll default to JavaScript patterns or vanilla Lua
- Roblox services — ServerScriptService, ReplicatedStorage, these mean nothing to it
- Rojo's file mapping — the
.server.luauand.client.luaunaming convention - Roblox-specific patterns — RemoteEvents, DataStores, the whole client-server architecture
I found this out the hard way. My first attempt at "create a sprint system," Claude gave me a Node.js Express server. Not exactly what I needed.
The Manual Setup (Step by Step)
Step 1: Install Claude Code
npm install -g @anthropic-ai/claude-code
You'll need an Anthropic API key — Claude will ask for it the first time you run it. Typical Roblox development costs a few dollars per month in API usage. Not free, but way cheaper than the time it saves.
Step 2: Install Rojo
Rojo is the bridge between your code editor and Roblox Studio. Without it, Claude can write perfect code that just... sits on your hard drive doing nothing.
# Install aftman first (it's a tool manager — yes, a tool to install tools)
aftman add rojo-rbx/rojo
rojo init
rojo plugin install
If aftman gives you trouble on Windows, don't panic — it's a PATH issue 90% of the time. Close your terminal, open a new one, try again.
Step 3: Create the CLAUDE.md File
This is where the magic happens. Create a file called CLAUDE.md in your project root. Claude reads this automatically every time it starts, and it shapes everything it does.
Here's a solid starting point:
# Roblox Game Project
## Language
This project uses Luau (not Lua, not JavaScript). Always write Luau code.
## Project Structure
- src/server/ → ServerScriptService (server-only scripts)
- src/client/ → StarterPlayerScripts (client-only scripts)
- src/shared/ → ReplicatedStorage (shared modules)
## File Naming
- *.server.luau → Server Script
- *.client.luau → Local Script
- *.luau → ModuleScript
- init.luau → The script becomes the folder itself
## Key Patterns
- Use RemoteEvents for client-server communication
- Use ModuleScripts for reusable code
- Use DataStoreService for saving player data
- Use task.spawn() instead of coroutine.wrap()
- Use task.wait() instead of wait()
## Common Services
- Players: Get player objects
- ReplicatedStorage: Shared assets and modules
- ServerScriptService: Server-only code
- ServerStorage: Server-only assets
- UserInputService: Detect player input (client only)
- TweenService: Smooth animations
- RunService: Per-frame updates
## Anti-patterns to Avoid
- Never use wait() — use task.wait()
- Never use Instance.new() without setting Parent last
- Never trust the client — validate everything on server
- Never store sensitive data in ReplicatedStorage
You can (and should) customize this as your project grows. Add your game's specific modules, your naming conventions, whatever patterns you want Claude to follow. The more specific you are, the better the output.
Step 4: Start Everything
Open two terminals. In the first:
rojo serve
Then connect in Roblox Studio — Plugins tab, click Rojo, click Connect.
In the second terminal:
claude
Now tell it to build something. "Create a coin collection system with a leaderboard." Watch what happens.
Getting Better Results from Claude
The difference between "meh" output and "holy crap that actually works" is how you talk to Claude. A few things I've learned:
Be Specific About What You Want
Bad prompt: "Make a save system"
Good prompt: "Create a DataStore module in src/shared/ that saves player coins, inventory (a table of item IDs), and settings. Use UpdateAsync with retry logic. Include a function to load data when a player joins and auto-save when they leave."
The second prompt gives Claude enough context to write production-quality code. The first one gives you a coin flip between something decent and something broken.
Point Claude at Your Existing Code
If you already have scripts, Claude can read them and match your style:
"Read all the scripts in src/server/ and then create a new weapon system that follows the same coding style and uses the existing PlayerData module."
This is where Claude Code beats ChatGPT hard. It doesn't just generate code in a vacuum — it understands your project's actual structure and builds on it.
Paste Errors Directly
When something breaks (and it will), just copy the error from Studio's Output window:
"I'm getting this error: ServerScriptService.CombatHandler:47: attempt to index nil with 'Character'. The script is in src/server/CombatHandler.server.luau. Find and fix the bug."
Claude reads the file, finds the issue, and patches it. Usually faster than you'd find it yourself.
What a Real Workflow Looks Like
Here's a session from last week, building an obby checkpoint system:
- I told Claude: "Create an obby checkpoint system with auto-save"
- It created three files:
src/server/CheckpointService.server.luau— saves progress to DataStoresrc/shared/CheckpointConfig.luau— configuration (checkpoint IDs, spawn positions)src/client/CheckpointUI.client.luau— shows a notification when you hit a checkpoint
- Everything synced to Studio through Rojo instantly
- First test: the UI notification wasn't showing. Pasted the error, Claude fixed a missing RemoteEvent
- Second test: checkpoints weren't saving between sessions. Claude found it was using SetAsync instead of UpdateAsync
- Third test: worked perfectly
The whole thing took maybe 15 minutes. Writing that system from scratch, with proper DataStore handling and client-server communication? That's at least a couple hours of work.
Frequently Asked Questions
Does Claude Code connect to Roblox Studio directly?
No. Claude edits files on your computer, and Rojo syncs those files into Studio. You need both running — Rojo in one terminal, Claude in another. It sounds like extra work but it becomes second nature after a day.
How much does Claude Code cost?
It requires an Anthropic API key with usage-based pricing. For a typical Roblox development session — asking Claude to build features, debug issues, refactor code — expect a few dollars per month. Heavy usage might push that to $10-15.
Can Claude create 3D models or maps?
No. Claude works with code — scripts, modules, configuration files. You still design your world in Studio's visual editor. But Claude can write all the scripts that make those 3D objects actually do things. The parts, the terrain, the UI layout — that's still your job (or Studio's built-in tools).
Should I use Claude Code or Cursor for Roblox?
Depends on how you like to work. Claude Code is terminal-based — you type what you want and it builds it. No UI, no clicking. Cursor is a full code editor with inline AI suggestions, autocomplete, and a chat panel. Both connect to Studio through Rojo, and both work with Roxlit.
My take: Claude Code is better for greenfield work — "build me a combat system from scratch." Cursor is better for editing existing code where you want to see everything side by side.
Setting all of this up manually is a rite of passage, but it doesn't have to be. Roxlit handles the entire setup with one command — Rojo, the Studio plugin, project structure, and the CLAUDE.md file that makes Claude actually useful for Roblox development.