roblox-studio-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRoblox Studio MCP
Roblox Studio MCP
The official Roblox Studio MCP server is built into Studio. It provides direct access to the data model, script editing, code execution, asset generation, and playtesting. This skill documents every tool and the patterns for using them reliably.
官方Roblox Studio MCP服务器内置在Studio中,它提供对数据模型、脚本编辑、代码执行、资产生成和游戏测试的直接访问。本技能文档记录了每个工具以及可靠使用它们的模式。
Available Tools
可用工具
Scripts
脚本工具
| Tool | What it does |
|---|---|
| Read scripts by dot-notation path (e.g. |
| Apply multiple edits to a script. Creates the script if the path doesn't exist. |
| Fuzzy search for scripts by name. Returns up to 10 results. |
| Search for a string pattern across all scripts. Returns up to 50 matches. |
| 工具 | 功能 |
|---|---|
| 通过点符号路径读取脚本(例如 |
| 对脚本应用多项编辑操作。若路径不存在则创建脚本。 |
| 按名称模糊搜索脚本,最多返回10个结果。 |
| 在所有脚本中搜索字符串模式,最多返回50个匹配项。 |
Asset & Content Generation
资产与内容生成
| Tool | What it does |
|---|---|
| Generate a textured 3D mesh from a description. |
| Generate a custom material or texture. |
| Generate procedural models that scale and adapt automatically. |
| Insert assets, plugins, and models from the Creator Store. |
| 工具 | 功能 |
|---|---|
| 根据描述生成带纹理的3D网格。 |
| 生成自定义材质或纹理。 |
| 生成可自动缩放和适配的程序化模型。 |
| 从创作者商店插入资产、插件和模型。 |
Data Model Exploration
数据模型探索
| Tool | What it does |
|---|---|
| Investigate the place in parallel, returns a compact summary. |
| Explore instance hierarchy as flat JSON. Filter by path, type, keywords. |
| Detailed info about a specific instance: properties, attributes, children summary. |
| 工具 | 功能 |
|---|---|
| 并行探查场景,返回精简摘要。 |
| 将实例层级结构作为扁平化JSON进行探索,支持按路径、类型、关键词过滤。 |
| 获取特定实例的详细信息:属性、特性、子项摘要。 |
Luau Execution
Luau代码执行
| Tool | What it does |
|---|---|
| Run Luau code in Studio. Returns result or error. |
| 工具 | 功能 |
|---|---|
| 在Studio中运行Luau代码,返回结果或错误信息。 |
Playtesting
游戏测试
| Tool | What it does |
|---|---|
| Start or stop playtesting. |
| Retrieve output logs while the game is running. |
| Capture the current Studio viewport in Play mode. |
| Spawn a test character that runs through gameplay scenarios. |
| 工具 | 功能 |
|---|---|
| 启动或停止游戏测试。 |
| 检索游戏运行时的输出日志。 |
| 捕获Play模式下当前Studio视口的画面。 |
| 生成测试角色,运行游戏玩法场景。 |
Player Input Simulation
玩家输入模拟
| Tool | What it does |
|---|---|
| Move the player character to a position or instance. |
| Simulate key presses, holds, and text input. |
| Simulate mouse clicks, movement, and scrolling. |
| 工具 | 功能 |
|---|---|
| 将玩家角色移动到指定位置或实例处。 |
| 模拟按键按下、按住和文本输入。 |
| 模拟鼠标点击、移动和滚动操作。 |
Session Management
会话管理
| Tool | What it does |
|---|---|
| List all connected Studio instances (name, ID, active status). |
| Set which Studio instance receives subsequent tool calls. |
| 工具 | 功能 |
|---|---|
| 列出所有已连接的Studio实例(名称、ID、活跃状态)。 |
| 设置后续工具调用指向哪个Studio实例。 |
MCP Reliability Patterns
MCP可靠性模式
Statelessness
无状态性
execute_luauluau
-- ALWAYS re-acquire references at the start of every execute_luau call
local model = workspace:FindFirstChild("MyModel")
if not model then
model = Instance.new("Model")
model.Name = "MyModel"
model.Parent = workspace
endexecute_luauluau
-- 每次execute_luau调用开始时,务必重新获取引用
local model = workspace:FindFirstChild("MyModel")
if not model then
model = Instance.new("Model")
model.Name = "MyModel"
model.Parent = workspace
endSilent Failures
静默失败
execute_luauluau
-- Create then verify
local part = Instance.new("Part")
part.Name = "Floor"
part.Parent = workspace.MapRoot
-- Verify it exists
local check = workspace.MapRoot:FindFirstChild("Floor")
print(check and "OK" or "FAILED: Floor not created")execute_luauluau
-- 创建后验证
local part = Instance.new("Part")
part.Name = "Floor"
part.Parent = workspace.MapRoot
-- 验证对象是否存在
local check = workspace.MapRoot:FindFirstChild("Floor")
print(check and "OK" or "FAILED: Floor not created")Script Truncation
脚本截断
When writing scripts via or with , long scripts may silently truncate. For scripts over ~300 lines:
multi_editexecute_luauscript.Source = ...- Split into logical chunks
- Write each chunk separately using string concatenation
- After writing, read back the last 10-20 lines to verify no truncation
luau
-- Chunked write pattern
local s = game.ServerScriptService.MyScript
local part1 = [=[
-- chunk 1: services and config
local Players = game:GetService("Players")
...
]=]
local part2 = [=[
-- chunk 2: main logic
...
]=]
s.Source = part1 .. part2当通过 或 使用 编写脚本时,长脚本可能会被静默截断。对于超过约300行的脚本:
multi_editexecute_luauscript.Source = ...- 将脚本拆分为逻辑块
- 使用字符串拼接分别写入每个块
- 写入完成后,读取最后10-20行以验证未发生截断
luau
-- 分块写入模式
local s = game.ServerScriptService.MyScript
local part1 = [=[
-- 块1:服务与配置
local Players = game:GetService("Players")
...
]=]
local part2 = [=[
-- 块2:主逻辑
...
]=]
s.Source = part1 .. part2Batching
批量操作
- Part creation: 10-20 parts per call (safe), 25-50 with loops (risky)
- Script writes: one script per call for reliability
- Property changes: batch related changes in one call
- Verification: always verify after creation batches
- 部件创建:每次调用创建10-20个部件(安全),循环创建25-50个有风险
- 脚本写入:每次调用写入一个脚本以保证可靠性
- 属性修改:将相关修改批量放在一次调用中
- 验证:批量创建后务必进行验证
Ground Truth Rule
真实数据规则
Never guess coordinates, sizes, or property values from chat history. If you need current state, READ it:
luau
local part = workspace.MapRoot:FindFirstChild("Tower")
if part then
print("Position:", part.Position)
print("Size:", part.Size)
print("CFrame:", part.CFrame)
end永远不要从聊天历史中猜测坐标、尺寸或属性值。如果需要当前状态,请读取:
luau
local part = workspace.MapRoot:FindFirstChild("Tower")
if part then
print("Position:", part.Position)
print("Size:", part.Size)
print("CFrame:", part.CFrame)
endWorkflows
工作流程
Script Development
脚本开发
- Explore — Use to understand existing structure
search_game_tree - Read — Use to understand existing code before modifying
script_read - Write — Use to create or modify scripts
multi_edit - Verify — Use to confirm the write succeeded
script_read - Test — Use +
start_stop_playto testconsole_output
- 探索 — 使用 了解现有结构
search_game_tree - 读取 — 修改前使用 了解现有代码
script_read - 编写 — 使用 创建或修改脚本
multi_edit - 验证 — 使用 确认写入成功
script_read - 测试 — 使用 +
start_stop_play进行测试console_output
Building Geometry
几何构建
- Plan — Use to see what exists
search_game_tree - Build — Use to create parts (see roblox-building skill)
execute_luau - Verify — Use to count parts and check properties
execute_luau - Visual check — Use in play mode to see the result
screen_capture
- 规划 — 使用 查看现有内容
search_game_tree - 构建 — 使用 创建部件(参考roblox-building技能)
execute_luau - 验证 — 使用 统计部件数量并检查属性
execute_luau - 视觉检查 — 在Play模式下使用 查看结果
screen_capture
Debugging
调试
- Reproduce — to enter play mode
start_stop_play - Observe — to read errors/warnings
console_output - Inspect — or
inspect_instanceto check runtime stateexecute_luau - Fix — to patch the script
multi_edit - Retest — again
start_stop_play
- 复现 — 使用 进入Play模式
start_stop_play - 观察 — 使用 读取错误/警告信息
console_output - 检查 — 使用 或
inspect_instance检查运行时状态execute_luau - 修复 — 使用 修补脚本
multi_edit - 重新测试 — 再次使用
start_stop_play
Playtesting
游戏测试
- Start play mode with
start_stop_play - Navigate with
character_navigation - Interact with /
keyboard_inputmouse_input - Observe with and
console_outputscreen_capture - Stop with
start_stop_play
- 使用 启动Play模式
start_stop_play - 使用 导航
character_navigation - 使用 /
keyboard_input进行交互mouse_input - 使用 和
console_output观察screen_capture - 使用 停止测试
start_stop_play
MCP Mode Detection
MCP模式检测
Different MCP servers provide different tool sets. Detect what's available:
- Official Roblox MCP (built into Studio): ,
execute_luau,multi_edit,script_read,search_game_tree,start_stop_play, etc.generate_mesh - Community MCP (Chrrxs/robloxstudio-mcp): ,
execute_luau,get_file_tree,grep_scripts, plus per-peer execution.create_build - No MCP: Pure code generation only. Provide copy-paste-ready scripts.
Adapt your approach based on what tools are actually available. If a tool call fails with "not found", fall back gracefully.
不同的MCP服务器提供不同的工具集,需检测可用工具:
- 官方Roblox MCP(内置在Studio中):、
execute_luau、multi_edit、script_read、search_game_tree、start_stop_play等。generate_mesh - 社区MCP(Chrrxs/robloxstudio-mcp):、
execute_luau、get_file_tree、grep_scripts,以及点对点执行功能。create_build - 无MCP:仅支持纯代码生成,提供可直接复制粘贴的脚本。
根据实际可用工具调整方法。如果工具调用返回“未找到”错误,请优雅降级处理。
Setup Reference
设置参考
Windows
Windows系统
json
{
"mcpServers": {
"Roblox_Studio": {
"command": "cmd.exe",
"args": ["/c", "%LOCALAPPDATA%\\Roblox\\mcp.bat"]
}
}
}json
{
"mcpServers": {
"Roblox_Studio": {
"command": "cmd.exe",
"args": ["/c", "%LOCALAPPDATA%\\Roblox\\mcp.bat"]
}
}
}macOS
macOS系统
json
{
"mcpServers": {
"Roblox_Studio": {
"command": "/Applications/RobloxStudio.app/Contents/MacOS/StudioMCP"
}
}
}json
{
"mcpServers": {
"Roblox_Studio": {
"command": "/Applications/RobloxStudio.app/Contents/MacOS/StudioMCP"
}
}
}Enable in Studio
在Studio中启用
- Open Assistant
- Click ... > Manage MCP Servers
- Turn on "Enable Studio as MCP server"
Quick connect supports: Codex CLI, Claude Code, Claude Desktop, Cursor, Gemini CLI, VS Code.
- 打开助手(Assistant)
- 点击... > 管理MCP服务器(Manage MCP Servers)
- 开启“将Studio作为MCP服务器启用”(Enable Studio as MCP server)
快速连接支持:Codex CLI、Claude Code、Claude Desktop、Cursor、Gemini CLI、VS Code。