Overview
Thesearch_files tool searches for Roblox instances by name, class type, or script content. It returns matching instances with their paths and relevant information.
Parameters
Search query - can be an instance name, class type (e.g.,
"Script", "Part"), or Lua code pattern depending on the searchType.Examples by Search Type
Name searches:"MainScript"- Find instances named “MainScript”"Player"- Find instances with “Player” in their name
"Script"- Find all Script instances"Part"- Find all Part instances"ModuleScript"- Find all ModuleScripts
"function onClick"- Find scripts containing this function"game.Players"- Find scripts that reference Players service"while true do"- Find scripts with infinite loops
Type of search to perform. Must be one of:
"name"- Search by instance name (default)"type"- Search by class name"content"- Search within script source code
Search Type Details
Search Type Details
name: Searches the Name property of all instances. Case-sensitive substring matching.type: Searches by ClassName. Use exact class names like “Part”, “Script”, “Folder”, “LocalScript”, “ModuleScript”.content: Searches the Source property of Script, LocalScript, and ModuleScript instances. Uses substring matching in Lua code.
Return Value
Returns an array of matching instances with their information.Match Object Structure
Each match contains:- name (string) - The instance’s Name property
- className (string) - The instance’s ClassName
- path (string) - Full dot-notation path to the instance
- parent (string) - Path to the parent instance
- matchLine (number) - Line number where match was found (if applicable)
- matchPreview (string) - Preview of the matching code (if applicable)
Usage Examples
Search by Name
Find all instances named “MainScript”:Search by Type
Find all Part instances:Search by Type - Scripts
Find all Script instances (server scripts):Search by Type - ModuleScripts
Find all ModuleScripts:Search Script Content
Find scripts containing a specific function:Search for API Usage
Find scripts that use a specific Roblox API:Search for Common Patterns
Find scripts with infinite loops:Common Use Cases
1. Finding Duplicate Names
Search by name to find all instances with the same name:2. Inventory by Type
Get a count of all instances of a specific type:3. Code Auditing
Find all scripts using deprecated or problematic code:4. Feature Discovery
Find where a specific feature is implemented:5. Refactoring Support
Find all usages of a function or variable:Related Tools
- get_file_tree - Get complete instance hierarchy tree
- search_objects - Alternative search with property-based filtering
- get_project_structure - Get organized project structure
- get_script_source - Get the full source code of found scripts
- get_descendants - Get filtered descendants of an instance
Performance Considerations
Search Scope
- Name searches - Very fast, searches all instances
- Type searches - Fast, filtered by class name
- Content searches - Slower, must read all script sources
Large Projects
For very large projects:- Content searches may take several seconds
- Consider narrowing searches to specific services
- Use more specific queries to reduce matches
Notes
- Name and Type searches are case-sensitive
- Content searches perform substring matching (not regex)
- Empty results return an empty array
[] - The
pathfield can be used directly with other tools - Content searches only examine Script, LocalScript, and ModuleScript instances
Error Handling
Invalid Search Type
If an invalidsearchType is provided: