Get the module here:
rQuery is a free, open-source module designed to provide a more advanced alternative to Roblox’s built-in search functions (
:WaitForChild, etc.). It extends search functions to add more parameters to search. Currently, the module allows for:
- Searching instances for specified CollectionService tags
- Searching instances for properties with a specified value
- Defining a function to query (see
More features are planned! See the Roadmap below for more details.
Click me to read the API
Returns an rQuery object. The
object parameter is what rQuery will use for all queries.
rQuery:QueryFirstChildWithTag(tag: string, queryDescendants: boolean)
Returns the first child having CollectionService tag
queryDescendants is true, rQuery will search descendants returned by
object:GetDescendants(). Otherwise, it will use instances returned by
rQuery:QueryChildrenWithTag(tag: string, queryDescendants: boolean)
QueryFirstChildWithTag, but returns a table of all instances with CollectionService tag
tag, not just the first.
Returns the first ancestor with CollectionService tag
tag, with “first” being defined as the latest ancestor (e.g. an eligible
Parent would be returned even if
game had the tag).
Returns all ancestors of the object with CollectionService tag
rQuery:QueryFirstChildWithProperty(property: string, value: any, queryDescendants: boolean)
Returns the first descendant that has property
property of value
queryDescendants has the same function as every other use here.
rQuery:QueryChildrenWithProperty(property: string, value: any, queryDescendants: boolean)
QueryFirstChildWithProperty, but returns all eligible children, not just the first discovered.
rQuery:QueryFirstAncestorWithProperty(property: string, value: any)
QueryFirstChildWithProperty, but queries ancestors, not children.
rQuery:QueryAncestorsWithProperty(property: string, value: any)
QueryFirstAncestorWithProperty, but returns all eligible ancestors.
Changes the Instance the rQuery object uses for all queries.
rQuery:QueryFunction(direction: string, returnAll: boolean, filter)
An all-encompassing function that can be used for all queries.
direction has 3 valid values:
- “Children” searches the Instance’s immediate children.
- “Descendants” searches the Instance’s descendants.
- “Ancestors” searches the Instance’s ancestry.
returnAll will return all eligible objects. Otherwise, it will return only the first.
filter is a function that will return a boolean value when called as such:
Features currently planned for rQuery:
- An all-encompassing
Queryfunction that accepts a dictionary of parameters
Thanks for reading, and I look forward to the DevForum community's feedback!