OnStateChanged||doc136709

September 20, 2022

Format

local event = Checkbox:GetEvent("OnStateChanged")

Describe

The event is triggered when the selected state in the check box control changes.

Callback function parameters

Type name introduce
Checkbox checkbox Current checkbox

Code example

--Create a checkbox control
local checkbox = UI:CreateGUIWidget(Enum.WidgetType.Checkbox)
checkbox.Parent = UI.Root

local event = checkbox:GetEvent("OnStateChanged")
event:Bind(function(checkbox)
    print("checkbox state changed! ", checkbox.Selected)
end)