Overview
Read the source code of a Roblox script (LocalScript, Script, or ModuleScript) with line numbers for precise editing. Returns both raw source and numbered source for easy line identification.For large scripts (>1500 lines), use
startLine and endLine parameters to read specific sections and avoid performance issues.Parameters
Roblox instance path to the script using dot notationExamples:
game.ServerScriptService.MainScriptgame.StarterPlayer.StarterPlayerScripts.LocalScriptgame.ReplicatedStorage.Modules.DataManager
Start line number (1-indexed) for reading specific sections of large scriptsDefault: Read from beginning
End line number (inclusive) for reading specific sections of large scriptsDefault: Read to end
Response
Raw script source code without line numbers
Script source with line numbers prefixed (format:
lineNumber: code)Use this field to identify correct line numbers for editing operationsTotal number of lines in the script
Usage Examples
Read Entire Script
Read Specific Section (Large Scripts)
Example Workflow: Edit a Function
- Read script with line numbers:
- Identify target lines from numberedSource:
- Use line numbers for editing (see edit_script_lines)
Best Practices
Always Use numberedSource for Editing
Always Use numberedSource for Editing
When planning to edit, insert, or delete lines, always reference the
numberedSource field to identify correct line numbers. The line numbers are 1-indexed and match exactly what the editing tools expect.Read Sections for Large Scripts
Read Sections for Large Scripts
For scripts with >1500 lines, read specific sections using
startLine and endLine to improve performance and reduce response size.Verify Before Editing
Verify Before Editing
Always read the current source before making edits to ensure you’re working with the latest version and correct line numbers.
Script Type Support
Script Type Support
Works with all Roblox script types:
- Script (ServerScript)
- LocalScript
- ModuleScript
Line Number Format
ThenumberedSource field uses this format:
- Line numbers are 1-indexed (first line is 1, not 0)
- Empty lines are counted and numbered
- Line numbers are followed by
:(colon and space) - All subsequent editing operations use these exact line numbers
Related Tools
set_script_source
Replace entire script source
edit_script_lines
Replace specific line ranges
insert_script_lines
Insert new lines at position
delete_script_lines
Delete line ranges