Overview
The library instantiates a graphical interface featuring:
- Sidebar Navigation Tabs
- Categorized Sections
- Boolean Toggles
- Numeric Sliders
- Dropdown Menus
- RGB/HSV Color Pickers
- Input Keybinds
- Action Buttons
- Text Labels
- Dynamic Theme Support (with Auto-Dropdown generator)
Loading the Library
Recommended standard method if the file resides in your executor's workspace:
local source = readfile("onyx.lua")
local Lib = loadstring(source)()
or
local Lib = loadfile("onyx.lua")()
Create Window
local Window = Lib:CreateWindow("My Script", {
Size = {800, 600},
Theme = "Emerald"
})
Lib:CreateWindow(title, config)
Initializes the main graphical window.
- Parameters:
title(string),config(table?) - Supported config fields:
Size = {width, height},Theme = "Purple Haze" | "Midnight Blue" | "Blood Moon" | "Emerald" | "Frost" | "Neon Sunset" | "Obsidian",ToggleKey = Enum.KeyCode.X(optional, Default:RightAlt) - Returns:
Window
Minimal Example (Luau Optimized)
local source = readfile("onyx.lua")
local Lib = loadstring(source)()
local Window = Lib:CreateWindow("Test", { Theme = "Emerald" })
local Tab = Window:AddTab("Main")
Tab:AddSection("Test Features")
-- Best Practice: Define function before connecting
local function onEspToggled(state)
print("ESP Active:", state)
end
Tab:AddToggle("Enable ESP", false, onEspToggled)
Themes & Auto-Dropdown
Available internal themes:
Purple HazeMidnight BlueBlood MoonEmeraldFrostNeon SunsetObsidian
You can set a theme manually via script:
Window:SetTheme("Emerald")
Automatic Theme Switcher
You can instantly create a dropdown that contains all available themes. When the user selects a theme, the UI updates automatically. No extra coding required!
local SettingsTab = Window:AddTab("Settings")
SettingsTab:AddThemeDropdown("Select UI Theme")
Advanced Theme Options
Themes now support optional properties for animated gradients, glassmorphism and blur. Useful fields include:
GradientAngle— rotation of the gradient (0–360)GradientAnimated— enable gradient animation (boolean)GradientAnimStyle—"rotate","breathe","pulse", or"flow"GradientAnimSpeed,GradientAnimRange— animation controlsFrameTransparency,SidebarTransparency,TopbarTransparency— values 0–1GlassSheen— show subtle white sheen on sidebar/topbar (boolean)BlurEnabled,BlurSize— create/enable a globalBlurEffectinLighting
Themes["MyFancy"] = {
FrameBG = Color3.fromRGB(18,8,26),
UseGradient = true,
GradientColors = { ColorSequenceKeypoint.new(0, Color3.fromRGB(20,10,30)), ColorSequenceKeypoint.new(1, Color3.fromRGB(255,120,100)) },
GradientAngle = 120,
GradientAnimated = true,
GradientAnimStyle = "rotate",
GradientAnimSpeed = 30,
FrameTransparency = 0.04,
SidebarTransparency = 0.25,
TopbarTransparency = 0.12,
GlassSheen = true,
BlurEnabled = true,
BlurSize = 12,
}
ℹ️ BlurEnabled will create/enable a BlurEffect in the game's Lighting service; Window:Destroy() disables it again.
Tabs
local VisualsTab = Window:AddTab("Visuals")
local AimbotTab = Window:AddTab("Aimbot")
Sections
VisualsTab:AddSection("ESP Configuration")
Toggles
local function onEspChanged(state)
print("ESP:", state)
end
local ESPToggle = VisualsTab:AddToggle("ESP", false, onEspChanged)
-- Controller Usage:
ESPToggle:Set(true)
print(ESPToggle:Get())
Sliders
local function onFovChanged(value)
print("FOV Update:", value)
end
local FOVSlider = VisualsTab:AddSlider("FOV", 50, 300, 5, 120, onFovChanged)
-- With Formatter:
local function onSpeedChanged(value)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = value
end
local function formatSpeed(text, value)
return string.format("%s: %d WS", text, value)
end
local SpeedSlider = VisualsTab:AddSlider("Speed", 16, 100, 1, 16, onSpeedChanged, formatSpeed)
Dropdowns
local function onTargetSelected(value)
print("Targeting:", value)
end
local TargetDropdown = VisualsTab:AddDropdown("Hitbox", {"Head", "Torso", "Root"}, "Head", onTargetSelected)
-- Controller Usage:
TargetDropdown:Set("Torso")
TargetDropdown:Refresh({"Head", "Torso", "Legs"}, "Head")
Color Picker
local function onColorUpdated(color)
print("New RGB:", color)
end
local ColorPicker = VisualsTab:AddColorPicker("ESP Color", Color3.fromRGB(0, 255, 65), onColorUpdated)
-- Controller Usage:
ColorPicker:Set(Color3.fromRGB(255, 0, 0)) -- Overwrite color via script
local currentC = ColorPicker:Get()
ColorPicker:Toggle(true) -- Programmatically open the picker UI
Keybinds
local function onKeybindChanged(newKey)
print("Assigned Key:", newKey)
end
local AimKeybind = VisualsTab:AddKeybind("Aimlock Key", Enum.KeyCode.Q, onKeybindChanged)
Labels
local StatusLabel = VisualsTab:AddLabel("Status: Idle")
StatusLabel:Set("Status: Injecting...")
OnDestroy Callback
local function cleanupRoutine()
print("Window terminated. Clearing cache...")
-- Cleanup ESP drawings, reset variables, etc.
end
Window:OnDestroy(cleanupRoutine)
IsAlive Check
task.spawn(function()
while Window:IsAlive() do
-- ESP update logic here
task.wait(0.1)
end
print("Loop broken safely.")
end)
Destroy Window
Window:Destroy()
Complete Example (Luau Standard)
local Lib = loadstring(readfile("onyx.lua"))()
local Window = Lib:CreateWindow("Matrix Client", {
Size = {820, 620},
Theme = "Emerald"
})
local Visuals = Window:AddTab("Visuals")
local Aimbot = Window:AddTab("Aimbot")
local Settings = Window:AddTab("Settings")
-- ==============================
-- VISUALS TAB
-- ==============================
Visuals:AddSection("ESP Settings")
local function onEspToggled(state)
print("ESP state:", state)
end
local ESPToggle = Visuals:AddToggle("Enable ESP", false, onEspToggled)
local function onDistanceChanged(value)
print("Render Distance:", value)
end
local function formatDistance(text, value)
return string.format("%s: %d Studs", text, value)
end
local DistanceSlider = Visuals:AddSlider("Max Distance", 50, 1000, 10, 250, onDistanceChanged, formatDistance)
local function onTargetChanged(value)
print("Highlighting:", value)
end
local TargetDropdown = Visuals:AddDropdown("Target Part", {"Head", "Torso", "HumanoidRootPart"}, "Head", onTargetChanged)
local function onColorChanged(color)
print("ESP Color:", color)
end
local ESPColor = Visuals:AddColorPicker("ESP Color", Color3.fromRGB(0, 255, 65), onColorChanged)
local function onPanicClicked()
ESPToggle:Set(false)
end
Visuals:AddButton("Panic Button (Disable All)", onPanicClicked)
local Info = Visuals:AddLabel("System Status: ONLINE")
-- ==============================
-- AIMBOT TAB
-- ==============================
Aimbot:AddSection("Aim Settings")
local function onAimKeyChanged(key)
print("Aimbot bound to:", key)
end
Aimbot:AddKeybind("Aimbot Key", Enum.KeyCode.E, onAimKeyChanged)
-- ==============================
-- SETTINGS TAB
-- ==============================
Settings:AddSection("UI Configuration")
Settings:AddThemeDropdown("Select Theme")
-- ==============================
-- CLEANUP
-- ==============================
local function onExit()
print("Client disconnected.")
end
Window:OnDestroy(onExit)
AI Integration Prompt
Paste this strictly into an AI to generate scripts conforming to Luau standards using this library:
Use Onyx. ALWAYS use named `local function` for callbacks instead of anonymous inline functions (Luau best practice).
API:
- Lib:CreateWindow(title, {Size = {w, h}, Theme = "Emerald", ToggleKey = Enum.KeyCode.RightAlt}) -> Window
- Window:AddTab(name) -> Tab
- Window:SetTheme(name)
- Window:OnDestroy(callback)
- Window:IsAlive() -> boolean
- Window:Destroy()
- Tab:AddSection(text)
- Tab:AddToggle(text, default, callback) -> controller with :Set() and :Get()
- Tab:AddSlider(text, min, max, step, default, callback, formatter?) -> controller with :Set() and :Get()
- Tab:AddDropdown(text, options, default, callback) -> controller with :Set() and :Refresh()
- Tab:AddThemeDropdown(text) -> Creates an automatic theme switcher dropdown
- Tab:AddColorPicker(text, defaultColor, callback) -> controller with :Set(), :Get() and :Toggle()
- Tab:AddKeybind(text, defaultKey, callback) -> controller with :GetKey()
- Tab:AddButton(text, callback)
- Tab:AddLabel(text) -> controller with :Set()
Write a UI script for me for: [insert request here]
Important Notes
- The library is optimized for Luau/Roblox executor environments.
- Functions like
readfileandloadstringare executor-dependent. - Dropdowns require a simple table of strings:
{ "A", "B", "C" }. - Keybinds must initialize with a valid
Enum.KeyCode.