compareinstances Synchronous
Compare the underlying Roblox Instance identities of two references. Use it when one reference may have come from cloneref or another wrapper-producing API.
Luau
compareinstances(first: Instance, second: Instance) -> booleanParameters
| Parameter | Type | Description |
|---|---|---|
first | Instance | First Instance reference. |
second | Instance | Second Instance reference. |
Returns
booleantrue when both references point to the same engine Instance, even if their Luau wrappers differ.
Usage notes
This is an identity comparison, not a comparison of names, classes, or property values.
Example
Luau
local first = Instance.new("Folder")
local same = cloneref(first)
local different = Instance.new("Folder")
print(compareinstances(first, same)) -- true
print(compareinstances(first, different)) -- false
first:Destroy()
different:Destroy()