ReferenceInstances

compareinstances

Checks whether two references point at the same Instance, including references made by cloneref.

Syntax

compareinstances(a: Instance, b: Instance) -> boolean

Also available as

compare_instances

Parameters

ParameterTypeDescription
aInstanceThe first reference.
bInstanceThe second reference.

Returns

TypeDescription
booleantrue when both references point at the same Instance.

Example

local ref = cloneref(workspace)
print(ref == workspace)
print(compareinstances(ref, workspace))
print(compareinstances(workspace, game))

These are Game executor contracts. Check build requirements and session lifetimes before using them.