Volt

getcallbackvalue

Gets the function assigned to a callback property.

Syntax

getcallbackvalue(instance: Instance, property: string) -> function?

Parameters

ParameterTypeDescription
instanceInstanceThe instance
propertystringThe callback property name

Returns

TypeDescription
function?The callback function, or nil if not set

Description

getcallbackvalue retrieves the function assigned to a callback property like OnInvoke or OnClientEvent.

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")
print(callback(5)) -- 10

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: OnInvoke, OnClientInvoke, OnServerInvoke
  • Returns nil if no callback is set

On this page