Search script source
script_grepSearch Luau source across a Roblox place to locate definitions or usages before editing, returning matching lines with paths and line numbers.
Instructions
Searches inside Luau source across the place and returns matching lines with their paths and line numbers.
Use this to find where something is defined or used before editing it — it is far cheaper than reading whole scripts to look for one call.
Patterns are Lua patterns, which are not regular expressions: % escapes instead of backslash, there is no alternation, and - means a lazy quantifier. Set literal to search for text exactly as written, which is usually what you want for identifiers.
To look for several identifiers, pass them together as patterns (literal, up to 16): one pass over the place instead of one per name, and each line says which of them it matched. mode="files" lists matching scripts only; mode="counts" gives matching-line counts per pattern.
Results are grouped by script with its rev, which script_edit accepts as revision. Matches come from the script editor's live buffer, so unsaved edits are searched too.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'lines': matching lines. 'files': one row per matching script. 'counts': matching-line counts per pattern. | lines |
| path | No | Limit to this subtree, e.g. "ServerScriptService". Omit to search everywhere. | |
| limit | No | Maximum items to return (1-500). | |
| cursor | No | Opaque cursor from a previous call's `nextCursor`. Omit for the first page. | |
| literal | No | Treat `pattern` as plain text rather than a Lua pattern. | |
| pattern | No | Lua pattern, or exact text when `literal` is set, e.g. "PlayerAdded". | |
| patterns | No | Several literal strings searched in one pass, instead of `pattern`. | |
| studioId | No | Target Studio; omit for the active one. | |
| className | No | Restrict to one script class: "Script", "LocalScript" or "ModuleScript". | |
| ignoreCase | No | Case-insensitive. Both sides are lowercased, so pattern classes like %u stop being meaningful — combine with `literal`. | |
| contextLines | No | Lines of context to show either side of each match. |