Instances

Find hidden instances, fire interactions and reach non-scriptable properties.

10 functionssUNC 100%Lynx 0.0.0

Roblox's API only shows you part of the game. These functions find instances outside the tree, reach properties scripts normally can't, and trigger interactions directly.

References

cloneref

since 1.3.0
cloneref(instance: Instance): Instance

Returns a new reference to instance. It reads and writes the same object, but it's a distinct value: it isn't == to the original and has its own identity as a table key.

Parameters

instanceInstance
The instance to reference.

Returns

Instance

A new reference to the same instance.

Example

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

gethui

since 1.2.0
gethui(): Instance

Returns a container for your own interfaces, separate from PlayerGui and CoreGui. ScreenGuis parented here render normally and survive respawns.

Returns

Instance

The container.

Example

local gui = Instance.new("ScreenGui")
gui.Name = "MyTool"
local label = Instance.new("TextLabel")
label.Size = UDim2.fromOffset(220, 40)
label.Position = UDim2.fromOffset(20, 20)
label.Text = "Hello from Lynx"
label.Parent = gui
gui.Parent = gethui()

Finding instances

getinstances

since 1.0.0
getinstances(): {Instance}

Returns every Instance the client knows about, including ones that aren't parented to the game tree.

Returns

{Instance}

Every instance.

Example

local remotes = 0
for _, instance in getinstances() do
if instance:IsA("RemoteEvent") or instance:IsA("RemoteFunction") then
remotes += 1
end
end
print("remotes:", remotes)

getnilinstances

since 1.0.0
getnilinstances(): {Instance}

Returns every Instance whose Parent is nil. Games sometimes keep modules or remotes here, out of the tree.

Returns

{Instance}

Unparented instances.

Example

for _, instance in getnilinstances() do
print(instance.ClassName, instance.Name)
end

Signals

getconnections

since 1.0.0
getconnections(signal: RBXScriptSignal): {Connection}

Returns every connection to signal, including connections made by game scripts. Each is a Connection object you can inspect, fire, disable or disconnect.

Parameters

signalRBXScriptSignal
Any event, such as Part.Touched.

Returns

{Connection}

The signal's connections. See the table below.

Example

local UserInputService = game:GetService("UserInputService")
for _, connection in getconnections(UserInputService.InputBegan) do
local fn = connection.Function
local source = if fn then debug.info(fn, "s") else "C"
print(source, connection.Enabled)
end

Connection

Enabled
Typeboolean
Whether the connection fires. Change it with Enable and Disable.
ForeignState
Typeboolean
true when the connection was made by C code rather than Luau.
LuaConnection
Typeboolean
true when the connection was made from Luau.
Function
Typefunction?
The connected function. nil for foreign connections.
Thread
Typethread?
The thread the connection was made from.
Fire(...)
Typemethod
Calls the function immediately with the given arguments.
Defer(...)
Typemethod
Like Fire, but on the next resumption cycle.
Disable()
Typemethod
Stops the connection firing until Enable is called.
Enable()
Typemethod
Re-enables a disabled connection.
Disconnect()
Typemethod
Disconnects it permanently.

Interactions

fireclickdetector

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

Fires a ClickDetector as if the local player clicked it.

Parameters

detectorClickDetector
The detector to fire.
distancenumber?
Optional.The distance to report. Default 0.
eventstring?
Optional.Which signal to fire: "MouseClick", "RightMouseClick", "MouseHoverEnter" or "MouseHoverLeave". Default "MouseClick".

Example

local detector = workspace:FindFirstChildWhichIsA("ClickDetector", true)
if detector then
fireclickdetector(detector)
end

firetouchinterest

since 1.0.0
firetouchinterest(part: BasePart, other: BasePart, toggle: number): ()

Simulates a touch between two parts, firing Touched and TouchEnded as if they had physically met.

Parameters

partBasePart
The part doing the touching, usually part of your character.
otherBasePart
The part being touched.
togglenumber
0 begins the touch, 1 ends it.

Example

local character = game:GetService("Players").LocalPlayer.Character
local root = character and character:FindFirstChild("HumanoidRootPart")
local pad = workspace:FindFirstChild("TouchPad", true)
if root and pad then
firetouchinterest(root, pad, 0) -- begin
task.wait()
firetouchinterest(root, pad, 1) -- end
end

fireproximityprompt

since 1.4.0
fireproximityprompt(prompt: ProximityPrompt): ()

Triggers prompt as if the local player completed it, without waiting for HoldDuration. Triggered and TriggerEnded fire as normal.

Parameters

promptProximityPrompt
The prompt to trigger.

Example

for _, prompt in workspace:GetDescendants() do
if prompt:IsA("ProximityPrompt") and prompt.ActionText == "Open" then
fireproximityprompt(prompt)
break
end
end

Hidden properties

gethiddenproperty

since 1.1.0
gethiddenproperty(instance: Instance, property: string): (any, boolean)

Reads any property, including ones that aren't scriptable. Returns the value and whether the property is hidden from normal scripts.

Parameters

instanceInstance
The instance to read from.
propertystring
The property name, as it appears in the Roblox API dump.

Returns

(any, boolean)

The value, and true if the property is hidden.

Example

local fire = Instance.new("Fire")
local value, hidden = gethiddenproperty(fire, "size_xml")
print(value, hidden) --> 5 true

sethiddenproperty

since 1.1.0
sethiddenproperty(instance: Instance, property: string, value: any): boolean

Writes any property, including ones that aren't scriptable. Returns whether the property is hidden.

Parameters

instanceInstance
The instance to write to.
propertystring
The property name.
valueany
The new value. Must match the property's type.

Returns

boolean

true if the property is hidden.

Example

local fire = Instance.new("Fire")
sethiddenproperty(fire, "size_xml", 12)
print(fire.Size) --> 12