Cache

compareinstances

Compares two instance references and returns true when they point to the same instance.

Syntax

compareinstances(source: Instance, replacement: Instance): boolean

Arguments

NameTypeDescription
sourceInstanceFirst instance reference.
replacementInstanceSecond instance reference.

Returns

NameTypeDescription
equalbooleanTrue when both references point to the same instance.

Description

Compares two instance references and returns true when they point to the same instance.

Call it with 2 parameter(s): source, replacement. The argument table explains which values are required and which ones only refine the behavior.

It returns equal (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = compareinstances(game, game)
print(result)