Event:Connect
Connects a callback to a retained UI signal.
Syntax
Signature
Event:Connect(Callback: function) -> ConnectionAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Callback | function | Function to run when the UI signal fires. |
Returns
| Type | Description |
|---|---|
Connection | Connection with Connected and Disconnect(). |
Notes
When the signal fires, callbacks run in separate queued tasks. Callback errors are reported through warn.
Example
Luau
local Button = Drawing.create("TextButton", {Text = "Hello"})
local Connection = Button.MouseButton1Click:Connect(function() print("Clicked") end)