cloneref

Creates another reference to an instance wrapper.

Syntax

Signature
cloneref(Instance: Instance) -> Instance

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
InstanceInstanceInstance wrapper with an _id field.

Returns

TypeDescription
InstanceNew table proxy for the original wrapper.

Notes

Creates a separate table proxy that forwards field reads and writes to the original instance wrapper. It does not create another scene object. compareinstances recognizes the original and proxy as the same instance, while rawequal sees different tables.

Example

Luau
local Original = game:GetService("Players")
local Reference = cloneref(Original)
assert(compareinstances(Original, Reference))
print(rawequal(Original, Reference))