getinstances Synchronous

Take a snapshot of Instance wrappers known to the current runtime cache. It can include objects outside the DataModel, which a walk from game would miss.

Syntax
Luau
getinstances() -> {Instance}

Parameters

This function takes no arguments.

Returns

{Instance}

An array of currently known Instances.

Usage notes

This is a snapshot of the weak ObjectBridge registry, not a permanent list of every engine object. Retaining the result also retains its Instance references.

Example

Example
Luau
local instances = getinstances()
print("Known Instances:", #instances)
for _, instance in ipairs(instances) do
    if instance:IsA("ScreenGui") then print(instance.Name) end
end
Kawaii documentation