Volt

cloneref

Creates a new reference to an instance that compares as different.

Syntax

cloneref(instance: Instance) -> Instance

Parameters

ParameterTypeDescription
instanceInstanceThe instance to clone a reference to

Returns

TypeDescription
InstanceA new reference to the same instance

Description

cloneref creates a new reference to an instance. The cloned reference points to the same underlying object, but the two references are not equal when compared with ==.

Example

local part = workspace.Part
local clone = cloneref(part)

-- Both reference the same instance
print(part.Name)  -- "Part"
print(clone.Name) -- "Part"

-- But they compare as different
print(part == clone) -- false

-- Changes through one affect the other
clone.Name = "Renamed"
print(part.Name) -- "Renamed"

Use Cases

  • Anti-detection: Prevent games from detecting your references
  • Reference hiding: Create references that can't be found through equality checks

Verification

-- Verify they're the same underlying instance
print(compareinstances(part, clone)) -- true

On this page