getinstances
Returns live instances, optionally filtered by class.
Syntax
getinstances(className?: string) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
className? | string | The Roblox class name to match. |
Returns
| Type | Description |
|---|---|
table | Live instances, optionally filtered by class |
Description
getinstances is part of the Instances library. Instance helpers traverse the live DataModel and return instance proxies tied to the current game session.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
Example
for _, part in ipairs(getinstances("Part")) do
print(part)
end
Notes
- Returned instances are live proxies; they can become invalid if the object is destroyed.