edit_script
Replace exact text in a Roblox Studio script while leaving the rest untouched; fails on missing or ambiguous matches unless replaceAll is enabled.
Instructions
Partially edit a Script/LocalScript/ModuleScript: replaces the exact text old_text with new_text, leaving the rest of the source untouched. Fails if old_text is not found, or matches more than once (unless replaceAll=true). Prefer this over write_script for small changes.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"old_text": "<old_text>",
"new_text": "<new_text>"
},
"name": "edit_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the script | |
| force | No | Bypass safety checks (default false) | |
| client | No | Target a specific Studio client by name (as shown on the panel, e.g. "studio"). Omit to auto-pick: the only active client, or the most recently active one when several are connected. | |
| new_text | Yes | Text to put in place of old_text (empty string deletes it) | |
| old_text | Yes | Exact existing text to replace (must match the source precisely, including whitespace) | |
| replaceAll | No | Replace every occurrence of old_text instead of requiring a single match (default false) |