Event:Connect

Connects a callback to a retained UI signal.

Syntax

Signature
Event:Connect(Callback: function) -> Connection

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
CallbackfunctionFunction to run when the UI signal fires.

Returns

TypeDescription
ConnectionConnection 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)