Docs / Instance

Instance

Bulk Instance access — includes hidden services and orphaned (nil-parent) objects.

Library#07 of 23 Functions4
getinstances() → {Instance}
Every Instance in the current DataModel, including ones you can't normally reach.
aliasesgetinstancelist
lua
print(#getinstances())  --> e.g. 45231
getnilinstances() → {Instance}
Instances with no Parent.
lua
for _, obj in ipairs(getnilinstances()) do
    print(obj.ClassName, obj.Name)
end
gethui() → Instance
A hidden GUI container (usually CoreGui-adjacent) that game scripts can't enumerate.
aliasesget_hidden_gui
lua
local screen = Instance.new("ScreenGui")
screen.Parent = gethui()   -- safe from game GUI walkers
compareinstances(a: Instance, b: Instance) → boolean
true if both userdata point at the same underlying Instance (unwraps cloneref).
lua
local p  = game.Players.LocalPlayer
local p2 = cloneref(p)
print(compareinstances(p, p2))  --> true