setcallbackvalue
Assigns a callback property, the same as object[property] = callback.
Syntax
setcallbackvalue(object: Instance, property: string, callback: function?) -> ()
Also available as
setcallbackfunctionsetcallbackmemberset_callback_functionset_callback_memberset_callback_value
Parameters
| Parameter | Type | Description |
|---|---|---|
object | Instance | The Instance whose callback property to set. |
property | string | The callback's name. |
callback | function? | The new callback, or nil to clear it. |
Description
It is the counterpart of getcallbackvalue and is most useful for wrapping an existing callback.
Example
local remote = game.ReplicatedStorage.GetData
local original = getcallbackvalue(remote, "OnClientInvoke")
setcallbackvalue(remote, "OnClientInvoke", function(...)
print("server asked", ...)
return original(...)
end)
These are Game executor contracts. Check build requirements and session lifetimes before using them.
