getinstances
Returns every Instance reachable from the DataModel.
Syntax
getinstances() -> {Instance}
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
{Instance} | Array table of instances. |
Description
The VM walks the DataModel descendants recursively and pushes each instance into an array table.
The traversal is capped at 50,000 nodes to avoid freezing a large place.
Example
for _, inst in getinstances() do
if inst.ClassName == "RemoteEvent" then
print(inst:GetFullName())
end
end
Notes
- The DataModel root itself is not included.
- This call can be expensive; cache the result instead of calling it every frame.