Read scripts
script_readRead Luau code from Roblox Studio's live buffer with line numbers, so edits target the current unsaved source. Fetch full scripts or selected line ranges to avoid stale saved data.
Instructions
Reads Luau source from one or more scripts, with line numbers that script_edit accepts back verbatim.
Source comes from the Studio script editor's live buffer, so anything the user has typed but not yet saved is included. Reading the saved property instead would hand you stale code and you would 'fix' the change they just made.
Pass every script you need in one call, including when you want a different part of each: an entry may be a bare path for the whole file, or {path, startLine, endLine} for a window into that one script. The top-level startLine/endLine are the default for entries that do not carry their own.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes | Scripts to read, e.g. ["ServerScriptService.Systems.Combat"] or [{ path: "...Combat", startLine: 120, endLine: 180 }]. | |
| endLine | No | Default last line for entries without their own, inclusive. Omit to read to the end. | |
| studioId | No | Target Studio; omit for the active one. | |
| startLine | No | Default first line for entries without their own, 1-based and inclusive. Omit to start at the top. |