Skip to content

Instance

Functions for interacting with Roblox Instances, including cloning references, comparing instances, firing interaction events, and managing the instance cache.

cloneref

Creates a new reference to an Instance. The cloned reference points to the same object but == comparison with the original will return false.

Aliases: clonereference, cloneinstance

lua
cloneref(instance: Instance) -> Instance
ParameterTypeDescription
instanceInstanceThe Instance to clone a reference of

Example

lua
local Players = cloneref(game:GetService("Players"))
print(Players == game:GetService("Players")) --> false
print(Players.Name) --> "Players"

compareinstances

Compares two Instance references to check if they point to the same underlying object. Works even with cloned references.

lua
compareinstances(a: Instance, b: Instance) -> boolean
ParameterTypeDescription
aInstanceFirst Instance
bInstanceSecond Instance

Example

lua
local original = game:GetService("Players")
local cloned = cloneref(original)

print(original == cloned)                  --> false
print(compareinstances(original, cloned))  --> true

getinstances

Returns a weak list containing every Instance in the game's data model.

Aliases: getinstancelist

lua
getinstances() -> {Instance}

Example

lua
local instances = getinstances()
print("Total instances:", #instances)

getnilinstances

Returns a weak list of all Instances whose Parent is nil.

lua
getnilinstances() -> {Instance}

Example

lua
local nilInstances = getnilinstances()
for _, inst in pairs(nilInstances) do
    print(inst.ClassName, inst.Name)
end

getscripts

Returns a weak list of all script Instances (LocalScript, ModuleScript, Script) in the game.

lua
getscripts() -> {BaseScript}

Example

lua
local scripts = getscripts()
print("Total scripts:", #scripts)
for _, s in pairs(scripts) do
    print(s:GetFullName())
end

getrunningscripts

Returns a weak list of all currently running scripts (LocalScript, ModuleScript, Script).

lua
getrunningscripts() -> {BaseScript}

Example

lua
for _, script in pairs(getrunningscripts()) do
    print(script:GetFullName())
end

getloadedmodules

Returns a weak list of all loaded ModuleScripts.

lua
getloadedmodules() -> {ModuleScript}

Example

lua
for _, module in pairs(getloadedmodules()) do
    print(module:GetFullName())
end

gethui

Returns a protected ScreenGui container where GUIs can be hidden from game detection. Instances parented here are protected by Volcano.

lua
gethui() -> ScreenGui

Example

lua
local gui = Instance.new("ScreenGui")
gui.Parent = gethui() -- Protected from game scripts

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 100)
frame.Parent = gui

fireclickdetector

Fires a ClickDetector interaction event.

Aliases: firedetector

lua
fireclickdetector(detector: ClickDetector, distance: number?, event: string?) -> void
ParameterTypeDefaultDescription
detectorClickDetectorThe ClickDetector to fire
distancenumber?0Simulated distance from the detector
eventstring?"MouseClick"Event type to fire

Supported event types:

  • MouseClick
  • RightMouseClick
  • MouseHoverEnter
  • MouseHoverLeave

Example

lua
local detector = workspace.Part.ClickDetector
fireclickdetector(detector)

firetouchinterest

Fires a touch event between two parts.

lua
firetouchinterest(source: BasePart, target: BasePart, toggle: number) -> void
ParameterTypeDescription
sourceBasePartThe touching part
targetBasePartThe part to be touched
togglenumber0 to begin touch, 1 to end touch

Example

lua
local hrp = game.Players.LocalPlayer.Character.HumanoidRootPart
local targetPart = workspace.TouchPart

firetouchinterest(hrp, targetPart, 0) -- begin touch
task.wait(0.1)
firetouchinterest(hrp, targetPart, 1) -- end touch

fireproximityprompt

Fires a ProximityPrompt as if the player interacted with it.

lua
fireproximityprompt(prompt: ProximityPrompt) -> void
ParameterTypeDescription
promptProximityPromptThe ProximityPrompt to fire

Example

lua
local prompt = workspace.Part.ProximityPrompt
fireproximityprompt(prompt)

getobjects

Downloads and returns objects from a Roblox asset ID.

Aliases: GetObjects

lua
getobjects(asset_id: string) -> {Instance}
ParameterTypeDescription
asset_idstringThe asset URL (e.g., "rbxassetid://123456")

Example

lua
local objects = getobjects("rbxassetid://123456")
for _, obj in pairs(objects) do
    obj.Parent = workspace
end

Cache Library

Functions for managing Volcano's instance cache.

iscache

Returns true if the instance is currently in the cache.

Aliases: iscacheinstance, iscachedinstance

lua
iscache(instance: Instance) -> boolean

cacheinvalidate

Removes an instance from the cache, causing a new reference to be created next time it's accessed.

lua
cacheinvalidate(instance: Instance) -> void

cachereplace

Replaces an instance in the cache with another instance. Future references to the original will return the replacement.

lua
cachereplace(original: Instance, replacement: Instance) -> void

Example

lua
local part = workspace.Part
print(iscache(part)) --> true

cacheinvalidate(part)
print(iscache(part)) --> false

-- Replace workspace.Part reference with a different part
local fakePart = Instance.new("Part")
cachereplace(workspace.Part, fakePart)