example.lua (2)
example.lua (2)
local Library =
loadstring(game:HttpGet("https://raw.githubusercontent.com/nfpw/Personal-Scripts/
refs/heads/main/LIONARIA-Fork.lua"))()
local ThemeManager = loadstring(game:HttpGet(repo .. 'addons/ThemeManager.lua'))()
local SaveManager = loadstring(game:HttpGet(repo .. 'addons/SaveManager.lua'))()
-- You do not have to set your tabs & groups up this way, just a prefrence.
local Tabs = {
-- Creates a new tab titled Main
Main = Window:AddTab('Main'),
['Dev'] = Window:AddTab("Dev"),
['UI Settings'] = Window:AddTab('UI Settings'),
}
-- You can now call AddToggle, etc on the tabs you added to the Tabbox
]]
-- Groupbox:AddToggle
-- Arguments: Index, Options
local toggole = DevLeftBox:AddToggle('MyToggle', {
Text = 'This is a toggle',
Default = true, -- Default value (true / false)
Tooltip = 'This is a tooltip', -- Information shown when you hover over the
toggle
})
toggole:AddKeyPicker('KeyPicker', {
-- SyncToggleState only works with toggles.
-- It allows you to make a keybind which has its state synced with its parent
toggle
-- Example: Keybind which you use to toggle flyhack, etc.
-- Changing the toggle disables the keybind state and toggling the keybind
switches the toggle state
Default = 'MB2', -- String as the name of the keybind (MB1, MB2 for mouse
buttons)
SyncToggleState = false,
-- You can define custom Modes but I have never had a use for it.
Mode = 'Toggle', -- Modes: Always, Toggle, Hold
-- This should print to the console: "My toggle state changed! New value: false"
Toggles.MyToggle:SetValue(false)
-- Groupbox:AddButton
-- Arguments: Text, Callback
-- Button:AddButton
-- Arguments: Text, Callback
-- Adds a sub button to the side of the main button
-- Button:AddTooltip
-- Arguments: ToolTip
MyButton:AddTooltip('This is a button')
MyButton2:AddTooltip('This is a sub button')
-- Groupbox:AddLabel
-- Arguments: Text, DoesWrap
DevLeftBox:AddLabel('This is a label')
DevLeftBox:AddLabel('This is a label\n\nwhich wraps its text!', true)
-- Groupbox:AddDivider
-- Arguments: None
DevLeftBox:AddDivider()
-- Groupbox:AddSlider
-- Arguments: Idx, Options
DevLeftBox:AddSlider('MySlider', {
Text = 'This is my slider!',
-- Example:
-- Rounding 0 - 5
-- Rounding 1 - 5.1
-- Rounding 2 - 5.15
-- Rounding 3 - 5.155
Default = 0,
Min = 0,
Max = 5,
Rounding = 1,
-- This should print to the console: "MySlider was changed! New value: 3"
Options.MySlider:SetValue(3)
-- Groupbox:AddInput
-- Arguments: Idx, Info
DevLeftBox:AddInput('MyTextbox', {
Default = 'My textbox!',
Numeric = false, -- true / false, only allows numbers
Finished = false, -- true / false, only calls callback when you press enter
Options.MyTextbox:OnChanged(function()
print('Text updated. New text:', Options.MyTextbox.Value)
end)
-- Groupbox:AddDropdown
-- Arguments: Idx, Info
DevLeftBox:AddDropdown('MyDropdown', {
Values = { 'This', 'is', 'a', 'dropdown' },
Default = 1, -- number index of the value / string
Multi = false, -- true / false, allows multiple choices to be selected
Options.MyDropdown:OnChanged(function()
print('Dropdown got changed. New value:', Options.MyDropdown.Value)
end)
Options.MyDropdown:SetValue('This')
-- Multi dropdowns
DevLeftBox:AddDropdown('MyMultiDropdown', {
-- Default is the numeric index (e.g. "This" would be 1 since it if first in
the values list)
-- Default also accepts a string as well
Options.MyMultiDropdown:OnChanged(function()
-- print('Dropdown got changed. New value:', )
print('Multi dropdown got changed:')
for key, value in next, Options.MyMultiDropdown.Value do
print(key, value) -- should print something like This, true
end
end)
Options.MyMultiDropdown:SetValue({
This = true,
is = true,
})
-- Label:AddColorPicker
-- Arguments: Idx, Info
-- You can also ColorPicker & KeyPicker to a Toggle as well
DevLeftBox:AddLabel('Color'):AddColorPicker('ColorPicker', {
Default = Color3.new(0, 1, 0), -- Bright green
Title = 'Some color', -- Optional. Allows you to have a custom color picker
title (when you open it)
})
Options.ColorPicker:OnChanged(function()
print('Color changed!', Options.ColorPicker.Value)
end)
DevLeftBox:AddLabel('Keybind'):AddKeyPicker('KeyPicker', {
-- SyncToggleState only works with toggles.
-- It allows you to make a keybind which has its state synced with its parent
toggle
Default = 'MB2', -- String as the name of the keybind (MB1, MB2 for mouse
buttons)
SyncToggleState = false,
-- You can define custom Modes but I have never had a use for it.
Mode = 'Toggle', -- Modes: Always, Toggle, Hold
-- OnClick is only fired when you press the keybind and the mode is Toggle
-- Otherwise, you will have to use Keybind:GetState()
Options.KeyPicker:OnClick(function()
print('Keybind clicked!', Options.KeyPicker.Value)
end)
task.spawn(function()
while true do
wait(1)
Library:OnUnload(function()
print('Unloaded!')
Library.Unloaded = true
end)
-- UI Settings
local MenuGroup = Tabs['UI Settings']:AddLeftGroupbox('Menu')
-- Addons:
-- SaveManager (Allows you to have a configuration system)
-- ThemeManager (Allows you to have a menu theme system)
-- Builds our theme menu (with plenty of built in themes) on the left side
-- NOTE: you can also call ThemeManager:ApplyToGroupbox to add it to a specific
groupbox
ThemeManager:ApplyToTab(Tabs['UI Settings'])