Signal
Functions for interacting with Roblox signals (events) and their connections. These allow you to inspect, fire, replicate, and control event connections.
getconnections
Returns a table of connection objects for the given signal.
getconnections(signal: RBXScriptSignal) -> {Connection}| Parameter | Type | Description |
|---|---|---|
signal | RBXScriptSignal | The signal to get connections from |
Connection Object
| Member | Type | Description |
|---|---|---|
Function | function | The connected callback function |
Thread | thread | The thread of the connection |
Fire(...) | method | Fires this specific connection |
Defer(...) | method | Deferred fire of this connection |
Disconnect() | method | Disconnects this connection |
Disable() | method | Disables this connection |
Enable() | method | Enables this connection |
Enabled | boolean | Whether the connection is enabled |
Example
local connections = getconnections(game.Players.LocalPlayer.Chatted)
for _, conn in pairs(connections) do
print("Connection function:", conn.Function)
print("Enabled:", conn.Enabled)
endfiresignal
Fires all Lua connections on a signal with the provided arguments. Does not fire CoreScript connections.
Aliases: fireconnection
firesignal(signal: RBXScriptSignal, ...: any) -> void| Parameter | Type | Description |
|---|---|---|
signal | RBXScriptSignal | The signal to fire |
... | any | Arguments to pass to the connections |
Example
-- Fire the Chatted event as if the player said "hello"
firesignal(game.Players.LocalPlayer.Chatted, "hello")replicatesignal
Fires a signal on the server. The signal must be replicable (check with canreplicatesignal).
replicatesignal(signal: RBXScriptSignal, ...: any) -> void| Parameter | Type | Description |
|---|---|---|
signal | RBXScriptSignal | The signal to replicate |
... | any | Arguments to pass |
WARNING
Not all signals can be replicated. Use canreplicatesignal() to check before calling.
Example
local signal = workspace.Part.Touched
if canreplicatesignal(signal) then
replicatesignal(signal, workspace.Part)
endcanreplicatesignal
Returns true if the signal can be replicated to the server.
Aliases: issignalreplicate, issignalreplicateable
canreplicatesignal(signal: RBXScriptSignal) -> booleanExample
local signal = workspace.Part.Touched
print(canreplicatesignal(signal)) --> true/falsegetreplicatesignalarguments
Returns a table describing the argument types expected by a replicable signal.
getreplicatesignalarguments(signal: RBXScriptSignal) -> tableExample
local args = getreplicatesignalarguments(workspace.Part.Touched)
for i, argType in pairs(args) do
print(i, argType)
endenableconnection
Enables a previously disabled connection.
Aliases: enablesignal
enableconnection(connection: Connection) -> voidExample
local connections = getconnections(game.Players.LocalPlayer.Chatted)
for _, conn in pairs(connections) do
enableconnection(conn)
enddisableconnection
Disables a connection without disconnecting it. The connection can be re-enabled later.
Aliases: disablesignal
disableconnection(connection: Connection) -> voidExample
-- Disable all connections on an event temporarily
local connections = getconnections(game.Players.LocalPlayer.Chatted)
for _, conn in pairs(connections) do
disableconnection(conn)
end
task.wait(5)
-- Re-enable them
for _, conn in pairs(connections) do
enableconnection(conn)
end