Roblox Enhanced

UI Library Documentation

Overview

The Roblox Enhanced UI Library is the official UI framework for all Roblox Enhanced scripts. Every script published on our platform must use this library to ensure consistency and quality across all user interfaces. It provides a modern, sleek design with easy-to-use components for building complex user interfaces.

Getting Started

To use the UI Library, simply load the library:

Lua
local EnhancedUI = loadstring(game:HttpGet("https://renhanced.deitsuki.games/uilib"))()

Then create a new window:

Lua
local window = EnhancedUI.Window.new({title = "My Menu"})

Create tabs and add components:

Lua
local mainTab = window:CreateTab({name = "Main"})
local button = mainTab:CreateButton({text = "Click Me", callback = function() print("Button clicked!") end})

Window Class

The Window class represents the main UI window.

Window.new({title})

Creates a new window with the specified title.

Parameters: title (string) - The title of the window
Returns: Window object

window:CreateTab({name})

Creates a new tab in the window.

Parameters: name (string) - The name of the tab
Returns: Tab object

window:ChangeTab(name)

Switches to the specified tab.

Parameters: name (string) - The name of the tab to switch to

window:SendNotification({text, duration})

Displays a notification message.

Parameters: - text (string) - The notification message text
- duration (number) - The duration to display the notification (in seconds)

window:Toggle()

Toggles the visibility of the window.

window:Destroy()

Destroys the window and cleans up resources.

Tab Class

The Tab class represents a tab within a window, containing various UI components.


tab:CreateTitle({text})

Creates a title element.

Parameters: text (string) - The text to display in the title
Methods: :SetText(newText) - Sets the title text to 'newText'

tab:CreateText({text})

Creates a text element.

Parameters: text (string) - The text to display
Methods: :SetText(newText) - Sets the text to 'newText'

tab:CreateButton({text, callback})

Creates a button.

Parameters: - text (string) - The text to display on the button
- callback (function) - The function to call when the button is clicked
Methods: - :SetText(newText) - Sets the button text to 'newText'
- :SetCallback(newCallback) - Sets the callback function to 'newCallback'
- :Trigger() - Simulates a button click

tab:CreateToggle({text, callback, default})

Creates a toggle switch.

Parameters: - text (string) - The text to display on the toggle
- callback (function) - The function to call when the toggle is changed
- default (boolean) - The default state of the toggle
Methods: - :Set(newState) - Sets the toggle state to 'newState'
- :Get() - Returns the current state of the toggle
- :SetText(newText) - Sets the toggle text to 'newText'
- :SetCallback(newCallback) - Sets the callback function to 'newCallback'

tab:CreateInput({text, callback, default})

Creates a text input field.

Parameters: - text (string) - The text to display in the input field
- callback (function) - The function to call when the input value changes
- default (string) - The default text to display in the input field
Methods: - :Set(newContent) - Sets the input field text to 'newContent'
- :Get() - Returns the current text in the input field
- :SetText(newPlaceholder) - Sets the placeholder text to 'newPlaceholder'
- :SetCallback(newCallback) - Sets the callback function to 'newCallback'

tab:CreateDropdown({text, items, default, callback})

Creates a dropdown selection.

Parameters: - text (string) - The text to display on the dropdown
- items (table) - The list of items to choose from
- default (string) - The default selected item
- callback (function) - The function to call when the selection changes
Methods: - :Set(newItem) - Sets the selected item to the value or index 'newItem'
- :Get() - Returns the current selected item and its index
- :SetItems(newItems, idx) - Updates the dropdown items and optionally sets the selected index
- :SetText(newText) - Sets the dropdown text to 'newText'
- :SetCallback(newCallback) - Sets the callback function to 'newCallback'

tab:CreateMultiSelect({text, items, default, callback})

Creates a multi-select dropdown.

Parameters: - text (string) - The text to display on the dropdown
- items (table) - The list of items to choose from
- default (table) - The list of the default selected items
- callback (function) - The function to call when the selection changes
Methods: - :Set(itemText, isSelected) - Sets the selection state of an item
- :Get() - Returns a table of selected items
- :SetItems(newItems, selected) - Updates the multiselect items
- :SetText(newText) - Sets the dropdown text to 'newText'
- :SetCallback(newCallback) - Sets the callback function to 'newCallback'

All UI components, returns their respective objects.

Each component have a :Destroy() method to remove it from the UI.

Components

This section provides detailed information about each UI component available in the library.

Button

A clickable button that executes a callback function when pressed.

Methods:

  • SetText(newText): Sets the button text to 'newText'
  • SetCallback(newCallback): Sets the callback function to 'newCallback'
  • Trigger(): Simulates a button click
  • Destroy(): Removes the button from the UI

Example:

Lua
local button = tab:CreateButton({text = "Activate", callback = function()
    print("Button activated!")
end})
button:SetText("Deactivate")  -- Change text later

Toggle

A switch that can be on or off, useful for enabling/disabling features.

Methods:

  • Set(newValue): Sets the toggle state to 'newState'
  • Get(): Returns the current state of the toggle
  • SetText(newText): Sets the toggle text to 'newText'
  • SetCallback(newCallback): Sets the callback function to 'newCallback'
  • Destroy(): Removes the toggle from the UI

Example:

Lua
local toggle = tab:CreateToggle({text = "Auto Farm", default = false, callback = function(state)
    if state then
        startFarming()
    else
        stopFarming()
    end
end})
print("Current state:" .. toggle:Get())  -- false

Input

A text input field for user text entry.

Methods:

  • Set(newContent): Sets the input field text to 'newContent'
  • Get(): Returns the current text in the input field
  • SetText(newPlaceholder): Sets the input field placeholder text to 'newPlaceholder'
  • SetCallback(newCallback): Sets the callback function to 'newCallback'
  • Destroy(): Removes the input from the UI

Example:

Lua
local input = tab:CreateInput({text = "Enter username", default = "Player123", callback = function(text)
    print("Username entered:" .. text)
end})
input:Set("NewPlayer")  -- Change value

Dropdown

A single-selection dropdown menu.

Methods:

  • Set(newItem): Sets the selected item to the value or index 'newItem'
  • Get(): Returns the current selected item and its index
  • SetItems(newItems, idx): Updates the dropdown items and optionally sets the selected index
  • SetText(newText): Sets the dropdown text to 'newText'
  • SetCallback(newCallback): Sets the callback function to 'newCallback'
  • Destroy(): Removes the dropdown from the UI

Example:

Lua
local dropdown = tab:CreateDropdown({text = "Difficulty", items = {"Easy", "Medium", "Hard"}, default = 1, callback = function(selected, index)
    print("Selected:" .. selected .. "at index" .. index)
end})
dropdown:Set("Hard")  -- Select "Hard"
print(dropdown:Get().value .. ", " .. dropdown:Get().index)  -- Print "Hard, 3"

Multi-Select

A multi-selection dropdown allowing multiple choices.

Methods:

  • Set(itemText, isSelected): Sets the selection state of an item
  • Get(): Returns a table of selected items
  • SetItems(newItems, idx): Updates the multiselect items
  • SetText(newText): Sets the dropdown text to 'newText'
  • SetCallback(newCallback): Sets the callback function to 'newCallback'
  • Destroy(): Removes the multi-select from the UI

Example:

Lua
local multiselect = tab:CreateMultiSelect({text = "Features", items = {"Auto", "ESP", "Speed"}, default = {"ESP"}, callback = function(item, selected, allSelected)
    print(item, "is now", selected and "selected" or "deselected")
    print("All selected:", allSelected)
end})
local selected = multiselect:Get()  -- Table of selected items

Title and Text

Display elements for showing information.

Methods:

  • SetText(newText): Updates the displayed text
  • Destroy(): Removes the element from the UI

Example:

Lua
local title = tab:CreateTitle({text = "Settings Panel"})
local text = tab:CreateText({text = "Adjust your preferences below."})
title:SetText("Advanced Settings")  -- Update title

Notifications

The notification system displays temporary messages to the user.

Lua
window:SendNotification({text = "This is a notification!", duration = 5})

Notifications appear in the bottom-right corner.

Examples

Basic Window with Button

Lua
local EnhancedUI = loadstring(game:HttpGet("https://renhanced.deitsuki.games/uilib"))()

local window = EnhancedUI.Window.new({title = "My Script"})
local mainTab = window:CreateTab({name = "Main"})

local clickCount = 0
local button = mainTab:CreateButton({text = "Click Me", callback = function()
    clickCount = clickCount + 1
    button:SetText("Clicked " .. clickCount .. " times")
end})

Toggle and Input

Lua
local toggle = mainTab:CreateToggle({text = "Enable Feature", callback = function(state)
    print("Feature enabled:", state)
end, default = false})

local input = mainTab:CreateInput({text = "Enter name", callback = function(text)
    print("Name entered:", text)
end, default = "Default Name"})

Dropdown Selection

Lua
local options = {"Option 1", "Option 2", "Option 3"}
local dropdown = mainTab:CreateDropdown({text = "Choose Option", items = options, default = 1, callback = function(selected, index)
    print("Selected:", selected, "Index:", index)
end})

Multi-Select

Lua
local items = {"Item A", "Item B", "Item C"}
local multiselect = mainTab:CreateMultiSelect({text = "Select Items", items = items, callback = function(item, selected, allSelected)
    print(item, "is now", selected and "selected" or "deselected")
end})

Notification

Lua
window:SendNotification({text = "Script loaded successfully!"})