Event Handling
The Event module simplifies connecting UI events.
Event.Connect(instance, eventName, callback) -> RBXScriptConnection
Parameters
- instance
- Type:
Instance
- Required:
Yes
- Description: The instance on which to connect an event.
- Type:
- eventName
- Type:
string
- Required:
Yes
- Description: The name of the event to connect to.
- Type:
- callback
- Type:
function
- Required:
Yes
- Description: The function to call when the event is triggered.
- Type:
Returns
- RBXScriptConnection
- Type:
RBXScriptConnection
- Always:
Yes
- Description: A connection object for the event, allowing disconnection if needed.
- Type:
Description
Connects a callback function to a specified event on a UI instance.
lua
Vuxel.Event.Connect(myButton, "MouseButton1Click", function()
print("Button clicked!")
end)