Bind||doc136354

September 20, 2022

Format

BindableEvent:Bind(callback)

Describe

Bind a callback function that receives multiple group parameters and returns a binding handle. Unbind events by destroying the binding handle.

parameter

Variable name Type Describe
callback function Callback Function

Return value

Type Describe
BindHandle binding handle

Code example

Bind the global event of player login and print player information.

local bindableEvent = Event:GetEvent("OnPlayerLogin")
bindableEvent:Bind(function(player)
    print("OnPlayerLogin", player)
end)