Objects & instances

Inspect Objects and Instances, read callbacks and save models.

14 functionssUNC 100%Lynx 0.747

The Instance API finds cached objects, creates references, reads callback properties, and triggers interactions. Callback readers accept Objects, including Instances; enumeration and reference functions use Instances.

Enumeration

getinstances

getinstances(): {Instance}

getinstances returns the live Instances tracked by the client’s Lua instance cache.

Also available as get_instances, getinstancecache and get_instance_cache.

Returns

{Instance}

An array of cached live Instances.

getnilinstances

getnilinstances(): {Instance}

getnilinstances returns cached Instances whose Parent is nil.

Also available as get_nil_instances.

Returns

{Instance}

An array of unique cached Instances with no parent.

getscripts

getscripts(excludeCore: boolean?): {LuaSourceContainer}

getscripts returns cached LocalScripts, ModuleScripts, and Scripts configured to run on the client.

Also available as get_scripts.

Parameters

excludeCoreboolean??
Optional.Whether to omit descendants of CoreGui and CorePackages. Default false.

Returns

{LuaSourceContainer}

The cached client script objects.

getmodules

getmodules(excludeCore: boolean?): {ModuleScript}

getmodules returns the ModuleScripts tracked by the client’s instance cache.

Also available as get_modules.

Parameters

excludeCoreboolean??
Optional.Whether to omit descendants of CoreGui and CorePackages. Default false.

Returns

{ModuleScript}

The cached ModuleScripts.

cloneref

cloneref(instance: Instance): Instance?

cloneref creates a separate Lua reference to an Instance without duplicating the Instance itself.

Also available as clonereference, clone_ref, clone_reference, duplicateref and duplicate_ref.

Parameters

instanceInstance
The Instance for which to create another reference.

Returns

Instance?

A new Lua reference to the same engine Instance, or no values if the Instance reference cache is unavailable.

compareinstances

compareinstances(first: Instance, second: Instance): boolean

compareinstances returns whether two references point to the same Instance.

Also available as compare_instances.

Parameters

firstInstance
The first Instance reference to compare.
secondInstance
The second Instance reference to compare.

Returns

boolean

True when both references identify the same Instance.

gethui

gethui(): Instance?

gethui returns the UI container to which scripts can parent their interfaces.

Also available as get_hidden_ui and get_hidden_gui.

Returns

Instance?

A distinct cached CoreGui reference, or nil when unavailable.

getcallbackvalue

getcallbackvalue(object: Object, property: string): any?

getcallbackvalue returns the value assigned to an Object’s callback property, including properties that cannot normally be read.

Also available as get_callback_value.

Parameters

objectObject
The Object that owns the requested member.
propertystring
The name of the property to access.

Returns

any?

The assigned callback value, or nil if no valid callback reference exists.

getcallbackthread

getcallbackthread(object: Object, property: string): thread?

getcallbackthread returns the coroutine associated with an Object’s assigned callback.

Also available as get_callback_thread.

Parameters

objectObject
The Object that owns the requested member.
propertystring
The name of the property to access.

Returns

thread?

The callback’s owning coroutine, or nil if its reference is no longer valid.

Example

local bindable = Instance.new("BindableFunction")
bindable.OnInvoke = function(value) return value end
local callback = getcallbackvalue(bindable, "OnInvoke")
local owner = getcallbackthread(bindable, "OnInvoke")
print(typeof(callback), typeof(owner))
bindable:Destroy()

firetouchinterest

firetouchinterest(first: BasePart, second: BasePart, state: number | boolean): ()

firetouchinterest reports the beginning or end of a touch between two BaseParts.

Also available as fire_touch_interest.

Parameters

firstBasePart
The first BasePart in the touch transition.
secondBasePart
The second BasePart in the touch transition.
statenumber | boolean
0 or false for touch; 1 or true for untouch.

Returns

()

This function returns no values.

fireproximityprompt

fireproximityprompt(prompt: ProximityPrompt): ()

fireproximityprompt activates a ProximityPrompt.

Also available as fire_proximity_prompt.

Parameters

promptProximityPrompt
The ProximityPrompt to activate.

Returns

()

This function returns no values.

fireclickdetector

fireclickdetector(detector: ClickDetector, distance: number?, event: string?): ()

fireclickdetector sends a click or hover interaction to a ClickDetector as the local player.

Also available as fire_click_detector.

Parameters

detectorClickDetector
The ClickDetector that receives the interaction.
distancenumber??
Optional.The distance passed with the click interaction. Default 0.
eventstring??
Optional.mouseclick, rightmouseclick, mousehoverenter, or mousehoverleave; case-insensitive. Default "mouseclick".

Returns

()

This function returns no values.

SaveInstance

The SaveInstance API exports client-available objects as model or place files in binary or XML format. Saving yields until the output is written and verified; a failed save raises an error.

saveinstance

Yields
saveinstance(root: (Instance | {Instance} | SaveOptions | string)?, options: (SaveOptions | string)?, filepath: string?): string?

saveinstance saves client-available Instances to a model or place file.

Also available as save_instance and synsaveinstance.

Parameters

root(Instance | {Instance} | SaveOptions | string)??
Optional.An Instance or dense array to save; omit to save game. A SaveOptions table or output filepath within the workspace can also be passed first.
options(SaveOptions | string)??
Optional.SaveOptions for an explicit root, or an output filepath within the workspace after a root or options table.
filepathstring??
Optional.The output path within the workspace, overriding FilePath in options.

Returns

string?

The output path within the workspace. Clipboard mode returns no values.

Example

local model = Instance.new("Model")
model.Name = "Example"
local part = Instance.new("Part")
part.Parent = model
local path = saveinstance(model, {Decompile = false, Binary = false}, "example.rbxmx")
print(path)
model:Destroy()

savegame

Yields
savegame(options: (SaveOptions | string)?, filepath: string?): string?

savegame saves the current DataModel to a place file.

Also available as save_game.

Parameters

options(SaveOptions | string)??
Optional.SaveOptions controlling the save, or an output filepath within the workspace passed first.
filepathstring??
Optional.The output path within the workspace, overriding FilePath in options.

Returns

string?

The place output path within the workspace. Clipboard mode returns no values.

SaveOptions

Option names are case-insensitive and unknown names are ignored. Use one spelling per option: supplying several aliases for the same field has no defined precedence. Mode has no effect. The available options and their aliases are listed below.

Binary
Type / defaultboolean = true
Binary .rbxl/.rbxm; false writes XML .rbxlx/.rbxmx. XML is its inverse alias.
CompressionMode
Type / defaultstring | boolean = "zstd"
Binary chunk compression: "zstd", "lz4" or "". true selects zstd; false disables compression. Other strings raise an error.
DisableCompression
Type / defaultboolean = false
true disables compression; false selects zstd.
CompressionLevel
Type / defaultnumber = 9
Converted to an integer, then clamped to -7–22 for Zstandard or 1–12 for LZ4 HC. A chunk is stored uncompressed when compression does not make it smaller.
CopyToClipboard
Type / defaultboolean = false
Alias Clipboard. Forces XML, copies the result instead of writing a file, and returns no value.
Decompile
Type / defaultboolean = true
Alias DecompileScripts. NoScripts is its inverse alias. Enables captured bytecode decompilation for script Source.
KeepUnusedLocals
Type / defaultboolean = true
Explicit decompiler setting; rejects non-booleans.
DecompilerOptions
Type / defaulttable
Decompiler options documented on the Scripts page. Nested fields are applied after top-level KeepUnusedLocals.
DecompileTimeout
Type / defaultnumber = 10
Alias Timeout. Shared decompilation budget in seconds. Accepts finite non-negative values or -1. 0 expires the batch immediately; -1 removes the overall deadline while keeping ScriptTimeout active.
CpuUsagePercent
Type / defaultnumber = 50
Finite 1–100. Configures snapshot scheduling and decompilation worker budget; not a promise of an exact OS CPU percentage.
DecompileWorkers
Type / defaultinteger = 0
0–32; 0 chooses an automatic worker count.
ScriptTimeout
Type / defaultnumber = 10
Aliases PerScriptTimeout and DecompileScriptTimeout. Finite per-request limit in seconds, 0.05–300, including the wait for a worker. The remaining DecompileTimeout budget can shorten this limit.
ScriptCache
Type / defaultboolean = true
Reuses one decompilation result for identical bytecode within the same export.
IgnoreDefaultProperties
Type / defaultboolean = true
Alias IgnoreDefaultProps. Omits properties equal to the captured class default.
IgnoreNotArchivable
Type / defaultboolean = true
Alias IgnoreArchivable. true ignores the Archivable restriction and includes such objects.
AvoidFileOverwrite
Type / defaultboolean = true
Adds a numeric suffix for an automatically generated filename that already exists. An explicitly supplied filepath is not protected by this option.
SavePlayerCharacters
Type / defaultboolean = true
Alias SaveCharacters. RemovePlayerCharacters is its inverse alias. Includes player-character models in place capture.
PreservePackageLinks
Type / defaultboolean = false
RemovePackageLinks is its inverse alias. false removes PackageLink metadata from captured output.
PreserveLegacyChat
Type / defaultboolean = false
MigrateLegacyChat is its inverse alias. false performs the writer's legacy-chat cleanup/migration.
PreserveCameraType
Type / defaultboolean = false
Keeps the captured camera type instead of normalizing it for editing. Rejects non-booleans.
RepairCameraFocus
Type / defaultboolean = true
Repairs editor camera focus during output normalization. Rejects non-booleans.
SaveNilInstances
Type / defaultboolean = true
Alias NilInstances. Adds cached detached objects to a NilInstances folder, with detached scripts disabled in the export. Rejects non-booleans.
FilePath
Type / defaultstring
Alias FileName. Workspace-relative output path; a missing extension is chosen from model/place and binary/XML mode.

Decompilation deadlines

DecompileTimeout and ScriptTimeout both default to 10 seconds. DecompileTimeout applies to the captured-bytecode batch, which can run alongside property capture. It does not limit instance traversal, property capture, file encoding, writing, or verification. Each bytecode request receives the shorter of ScriptTimeout and the remaining batch budget; waiting for a worker uses that same request deadline.

Set DecompileTimeout to -1 to remove the batch deadline while retaining the per-request ScriptTimeout. A value of 0 starts with an expired batch deadline, so no new bytecode requests are started. When a script times out, the export continues with successful results from other scripts. It keeps an existing readable Source when available; otherwise that script's Source contains a failure comment.

A timeout releases the result wait and allows export progress to continue. Native calls already running can finish in the background and retain their worker slots until cleanup, so concurrency remains bounded.

local path = saveinstance(game, {
DecompileTimeout = 30,
ScriptTimeout = 2,
DecompileWorkers = 4,
}, "scene.rbxl")
print(path)

Save progress

The save overlay reports the current phase. During decompilation it shows completed and total script counts, active and total worker counts, failures, and an active script's label or reference with elapsed time and its request limit in seconds. Timed-out scripts count as completed failures; the export can then proceed to encoding, writing, and verification.

Output behavior

Without FilePath, a place uses its PlaceId as the filename and a model uses saveinstance_model. A missing extension becomes .rbxl, .rbxlx, .rbxm, or .rbxmx according to the output type. Place exports omit CoreGui and CorePackages service roots and cannot include server-only data unavailable to the client. The output file is verified before its filename is returned.