getcallbackvalue
Reads a callback property, which scripts can assign but not read.
Syntax
getcallbackvalue(object: Instance, property: string) -> function?
Also available as
getcallbackfunctiongetcallbackmemberget_callback_functionget_callback_memberget_callback_value
Parameters
| Parameter | Type | Description |
|---|---|---|
object | Instance | The Instance whose callback property to read. |
property | string | The callback's name, such as "OnInvoke", "OnClientInvoke" or "OnServerInvoke". |
Returns
| Type | Description |
|---|---|
function? | The function currently assigned, or nil when none is set. A member that is not a callback raises an error. |
Description
Callbacks such as BindableFunction.OnInvoke and RemoteFunction.OnClientInvoke are write-only from Luau. This returns the function a script assigned, so you can call it, inspect it or wrap it with setcallbackvalue.
Example
local remote = game.ReplicatedStorage.GetData
local handler = getcallbackvalue(remote, "OnClientInvoke")
if handler then
print(handler("test"))
end
Notes
getcallbackthreadreturns the thread that installed the callback.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
