getinstancesbyclass
Returns all descendants whose ClassName matches exactly.
Syntax
getinstancesbyclass(className: string) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
className | string | The Roblox class name to match. |
Returns
| Type | Description |
|---|---|
table | All descendants whose ClassName matches exactly |
Description
getinstancesbyclass 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(getinstancesbyclass("Part")) do
print(part.Name)
end
Notes
- Returned instances are live proxies; they can become invalid if the object is destroyed.