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
cloneref(instance: Instance) -> Instance| Parameter | Type | Description |
|---|---|---|
instance | Instance | The Instance to clone a reference of |
Example
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.
compareinstances(a: Instance, b: Instance) -> boolean| Parameter | Type | Description |
|---|---|---|
a | Instance | First Instance |
b | Instance | Second Instance |
Example
local original = game:GetService("Players")
local cloned = cloneref(original)
print(original == cloned) --> false
print(compareinstances(original, cloned)) --> truegetinstances
Returns a weak list containing every Instance in the game's data model.
Aliases: getinstancelist
getinstances() -> {Instance}Example
local instances = getinstances()
print("Total instances:", #instances)getnilinstances
Returns a weak list of all Instances whose Parent is nil.
getnilinstances() -> {Instance}Example
local nilInstances = getnilinstances()
for _, inst in pairs(nilInstances) do
print(inst.ClassName, inst.Name)
endgetscripts
Returns a weak list of all script Instances (LocalScript, ModuleScript, Script) in the game.
getscripts() -> {BaseScript}Example
local scripts = getscripts()
print("Total scripts:", #scripts)
for _, s in pairs(scripts) do
print(s:GetFullName())
endgetrunningscripts
Returns a weak list of all currently running scripts (LocalScript, ModuleScript, Script).
getrunningscripts() -> {BaseScript}Example
for _, script in pairs(getrunningscripts()) do
print(script:GetFullName())
endgetloadedmodules
Returns a weak list of all loaded ModuleScripts.
getloadedmodules() -> {ModuleScript}Example
for _, module in pairs(getloadedmodules()) do
print(module:GetFullName())
endgethui
Returns a protected ScreenGui container where GUIs can be hidden from game detection. Instances parented here are protected by Volcano.
gethui() -> ScreenGuiExample
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 = guifireclickdetector
Fires a ClickDetector interaction event.
Aliases: firedetector
fireclickdetector(detector: ClickDetector, distance: number?, event: string?) -> void| Parameter | Type | Default | Description |
|---|---|---|---|
detector | ClickDetector | — | The ClickDetector to fire |
distance | number? | 0 | Simulated distance from the detector |
event | string? | "MouseClick" | Event type to fire |
Supported event types:
MouseClickRightMouseClickMouseHoverEnterMouseHoverLeave
Example
local detector = workspace.Part.ClickDetector
fireclickdetector(detector)firetouchinterest
Fires a touch event between two parts.
firetouchinterest(source: BasePart, target: BasePart, toggle: number) -> void| Parameter | Type | Description |
|---|---|---|
source | BasePart | The touching part |
target | BasePart | The part to be touched |
toggle | number | 0 to begin touch, 1 to end touch |
Example
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 touchfireproximityprompt
Fires a ProximityPrompt as if the player interacted with it.
fireproximityprompt(prompt: ProximityPrompt) -> void| Parameter | Type | Description |
|---|---|---|
prompt | ProximityPrompt | The ProximityPrompt to fire |
Example
local prompt = workspace.Part.ProximityPrompt
fireproximityprompt(prompt)getobjects
Downloads and returns objects from a Roblox asset ID.
Aliases: GetObjects
getobjects(asset_id: string) -> {Instance}| Parameter | Type | Description |
|---|---|---|
asset_id | string | The asset URL (e.g., "rbxassetid://123456") |
Example
local objects = getobjects("rbxassetid://123456")
for _, obj in pairs(objects) do
obj.Parent = workspace
endCache Library
Functions for managing Volcano's instance cache.
iscache
Returns true if the instance is currently in the cache.
Aliases: iscacheinstance, iscachedinstance
iscache(instance: Instance) -> booleancacheinvalidate
Removes an instance from the cache, causing a new reference to be created next time it's accessed.
cacheinvalidate(instance: Instance) -> voidcachereplace
Replaces an instance in the cache with another instance. Future references to the original will return the replacement.
cachereplace(original: Instance, replacement: Instance) -> voidExample
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)