Write script source
set_script_sourceReplaces a script's entire source and updates the open Studio editor buffer so changes appear immediately without stale files.
Instructions
Replace the entire Source of a script. Prefer edit_script for small changes: rewriting a file from memory risks losing code you have not read. If the script is open in Studio, the editor buffer is updated through ScriptEditorService so Studio does not show a stale file.
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>",
"source": "<source>"
},
"name": "set_script_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Instance path. Accepts "Workspace.Model.Part", "game.Workspace.Model.Part" or "game.Workspace[\"My Part\"].Model". Use "game" or omit for the DataModel root. | |
| source | Yes | Complete new source text. |