edit_script_lines
Replace a specific range of lines in a Roblox script with new text without resending the full source. Returns the new line count; re-read line numbers before another edit.
Instructions
Replace a range of lines in one script with new text, without resending the whole Source; returns the new line count. Overwrites those lines. Line numbers shift after each edit, so re-read with script_source or grep_scripts before a second edit. When you can quote the text to change, patch_script is safer because it doesn't depend on line numbers.
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>",
"startLine": "<startLine>",
"endLine": "<endLine>",
"newText": "<newText>"
},
"name": "edit_script_lines"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Script to edit. Dot path from the DataModel root, e.g. "Workspace.Map.Door" or "StarterGui.HUD.Frame". A leading "game." is optional; a duplicate sibling name takes the suffix Tufan prints, e.g. "Part (2)". | |
| place | No | Target place (PlaceId or project name). Defaults to the bound/sole connected place. | |
| endLine | Yes | Last line to replace, inclusive. Use startLine - 1 to insert before startLine without removing anything. | |
| newText | Yes | Replacement text; may span several lines. "" deletes the range. | |
| startLine | Yes | First line to replace, counting from 1. |