Last updated: Aug 1, 20262 min read

Toggle Switch

An on/off checkbox that supports inline keybind shortcuts.

Toggle Switch#

LUA Script
1local Toggle = Section:CreateToggle(name, default, callback, description)

Toggle Methods#

  • Toggle:SetState(state): Set state boolean and update layout.
  • Toggle:GetValue(): Returns active state boolean.
  • Toggle:AddKeybind(defaultKey, keyCallback): Bind an inline key shortcut. Returns inline keybind object.

Complete Code Example#

Here is a complete copy-pasteable script showing how to build toggle switches with inline keybind shortcuts:

LUA Script
1local ValincUi = loadstring(game:HttpGet("https://cdn.vinzhub.com/scripts/Liblery%20Ui/VALINC-QUARTZ/57319f29599c47672f19f8d56d53ffbe/a6b3ccb1f04d1d7d06232a9c5d25779e2af89c12992bebae.lua"))()
2
3local Window = ValincUi:CreateWindow("Toggle Hub", "toggle-right", "gold")
4local Tab = Window:CreateTab("Automation")
5local Section = Tab:CreateSection("Auto Farm")
6
7-- Create a main toggle switch
8local FarmToggle = Section:CreateToggle("Auto Kill Mobs", false, function(state)
9 print("Auto Kill Mobs is now: " .. (state and "ENABLED" or "DISABLED"))
10end, "Automatically attacks nearby monsters.")
11
12-- Attach an inline keyboard keybind to trigger the toggle directly
13FarmToggle:AddKeybind(Enum.KeyCode.F, function(key)
14 print("Inline Keybind pressed! Key: " .. tostring(key))
15end)