AddToggle

Add toggle to group box

Syntax

Groupbox:AddToggle({
    Index = "unique tool index",
    Default = false,
    Text = "Toggle Text"
})

Both the Index and Default parameters are optional. Although, if Index is left out, you need to have a unique name. Default value is false

  • <string> Index - Allows for duplicate names. Must be unique.

  • <string> Text - Text displayed on toggle.

  • <bool> Default - The value that will be used as default.

Toggle Functions

Toggle:OnChanged(function(value) -- If toggle value changed
    print(value)
end)

Toggle:SetValue(bool)
Toggle:AddTooltip("Tooltip Text")
Toggle:DisconnectKeybindButton()
Toggle:ConnectKeybindButton(KeybindButton)

Example

Code shown below is missing some critical syntax for simplicity

local Toggle = Groupbox:AddToggle({Index = "toggle_1", Default = true, Text = "RGB UI Enabled"})

--// If toggle value changes
Toggle:OnChanged(function(value)
    Window.Rainbow = value
end)
Toggle Demo

Last updated