getcallbackmember / getcallbackvalue

Gets the value assigned to an object callback property.

Syntax

getcallbackmember(object: Object, property: string, returnRaw?: boolean) -> any?
getcallbackvalue(object: Object, property: string, returnRaw?: boolean) -> any? -- alias

Parameters

ParameterTypeDescription
objectObjectThe object, including an Instance
propertystringThe callback property name
returnRawboolean?Return a non-function callback object instead of filtering it to nil

Returns

TypeDescription
any?The callback value, or nil when no callback is assigned

Description

getcallbackvalue reads async callback properties such as BindableFunction.OnInvoke that are normally exposed as write-only. By default, values that are not functions are returned as nil; pass true to retrieve the raw callback object.

The canonical function name is getcallbackmember; getcallbackvalue is an alias.

Example

-- Create a BindableFunction
local bindable = Instance.new("BindableFunction")
bindable.OnInvoke = function(arg)
    return arg * 2
end

-- Get the callback
local callback = getcallbackvalue(bindable, "OnInvoke")
if callback then
    print(callback(5)) -- 10
end

Inspecting Remote Callbacks

-- Find RemoteFunction callbacks
for _, obj in ipairs(game:GetDescendants()) do
    if obj:IsA("RemoteFunction") then
        local callback = getcallbackvalue(obj, "OnClientInvoke")
        if callback then
            print("Found callback on:", obj:GetFullName())
        end
    end
end

Notes

  • Common callback properties include OnInvoke, OnClientInvoke, and OnServerInvoke
  • Returns nil if no callback is set