Skip to content
Saiko

cloneref

Returns a fresh reference to an instance that behaves identically but is not equal to the original, so scripts comparing references cannot detect that you hold it.

Signature

luau
cloneref<T>(instance: T & Instance): T

Parameters

instanceInstance

The instance to re-reference.

Returns

Instance

Example

luau
local players = game:GetService("Players")
local safe = cloneref(players)

print(safe == players) --> false
print(compareinstances(safe, players)) --> true
print(safe.LocalPlayer.Name)