chatgpt and deepseek ui library
Key RequiredUniversal

chatgpt and deepseek ui library

Universal Scriptsubqsubq 803 views 14 executesUpdated Oct 16, 2025
3.3/ 5(3 votes)
2167% Positive
Lua Script•1315 lines (48635 chars)
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local HttpService = game:GetService("HttpService")

local LocalPlayer = Players.LocalPlayer

local ICONS = {
    Home      = "rbxassetid://7539983773",
    Player    = "rbxassetid://7992557358", 
    Visuals   = "rbxassetid://7035631382",
    Settings  = "rbxassetid://7059346373",
    Info      = "rbxassetid://4871684504",
    Close     = "rbxassetid://14895360837",
    Minimize  = "rbxassetid://14895360989",
    ToggleBtn = "rbxassetid://14895361052",
    ThemeBox  = "rbxassetid://13300918071"
}

local CONFIG_PATH = "SubqHub/config.json"

local DEFAULT_CONFIG = {
    Visible = true,
    Position = {X = 0.22, Y = 0.15},
    Size = {W = 760, H = 480},
    Theme = "Dark",
    Transparency = 0.05,
    ShowToggleButton = true,
    Font = "Gotham"
}

local function safeWriteFile(path, data)
    local ok, err = pcall(function() writefile(path, data) end)
    return ok, err
end

local function safeReadFile(path)
    local ok, content = pcall(function() return readfile(path) end)
    if ok then return content end
    return nil
end

local CONFIG = DEFAULT_CONFIG
do
    local raw = safeReadFile(CONFIG_PATH)
    if raw then
        local ok, parsed = pcall(function() return HttpService:JSONDecode(raw) end)
        if ok and type(parsed) == "table" then
            for k,v in pairs(DEFAULT_CONFIG) do
                if parsed[k] ~= nil then CONFIG[k] = parsed[k] end
            end
        end
    else
        pcall(function()
            safeWriteFile(CONFIG_PATH, HttpService:JSONEncode(DEFAULT_CONFIG))
        end)
    end
end

local UI = {}
UI.__index = UI

UI.FONT_MAP = {
    Gotham = Enum.Font.Gotham,
    SourceSans = Enum.Font.SourceSans,
    Roboto = Enum.Font.Legacy,
    Arial = Enum.Font.Arial,
    SciFi = Enum.Font.Code
}

UI.THEMES = {
    Dark = {
        Main = Color3.fromRGB(20, 24, 35),
        Secondary = Color3.fromRGB(32, 37, 52),
        Accent = Color3.fromRGB(0, 170, 255),
        Text = Color3.fromRGB(235, 235, 235),
        TextSecondary = Color3.fromRGB(170, 170, 170),
        Border = Color3.fromRGB(45, 50, 64)
    },
    Light = {
        Main = Color3.fromRGB(245,245,247),
        Secondary = Color3.fromRGB(230,230,235),
        Accent = Color3.fromRGB(2,120,255),
        Text = Color3.fromRGB(20,20,20),
        TextSecondary = Color3.fromRGB(90,90,90),
        Border = Color3.fromRGB(210,210,220)
    },
    Cyber = {
        Main = Color3.fromRGB(12, 18, 30),
        Secondary = Color3.fromRGB(20, 30, 45),
        Accent = Color3.fromRGB(0, 255, 180),
        Text = Color3.fromRGB(230,230,230),
        TextSecondary = Color3.fromRGB(160,160,160),
        Border = Color3.fromRGB(30, 40, 55)
    },
    Crimson = {
        Main = Color3.fromRGB(18, 14, 17),
        Secondary = Color3.fromRGB(36, 26, 30),
        Accent = Color3.fromRGB(255, 60, 90),
        Text = Color3.fromRGB(245,245,245),
        TextSecondary = Color3.fromRGB(170,160,160),
        Border = Color3.fromRGB(48,38,42)
    },
    Emerald = {
        Main = Color3.fromRGB(10, 18, 14),
        Secondary = Color3.fromRGB(20, 34, 28),
        Accent = Color3.fromRGB(0, 220, 120),
        Text = Color3.fromRGB(235,235,235),
        TextSecondary = Color3.fromRGB(160,170,160),
        Border = Color3.fromRGB(32,44,36)
    }
}

function UI.new(title)
    local self = setmetatable({}, UI)
    self.Title = title or "Subq Interface Reborn"
    self.Visible = true
    self.Tabs = {}
    self.CurrentTab = nil
    self.ScreenGui = nil
    self.MainFrame = nil
    self.NavFrame = nil
    self.TabContent = nil
    self.ToggleButton = nil
    self.ResizeCorner = nil
    self.Dragging = false
    self.Resizing = false
    self.Minimized = false
    self:Init()
    return self
end

function UI:tween(instance, props, tweenInfo)
    tweenInfo = tweenInfo or TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    local ok, t = pcall(function()
        return TweenService:Create(instance, tweenInfo, props)
    end)
    if ok and t then t:Play() end
end

function UI:SaveConfig()
    local tosave = {
        Visible = self.Visible,
        Position = {X = self.MainFrame.Position.X.Scale, Y = self.MainFrame.Position.Y.Scale},
        Size = {W = self.MainFrame.Size.X.Offset, H = self.MainFrame.Size.Y.Offset},
        Theme = self.CurrentThemeName or CONFIG.Theme,
        Transparency = self.CurrentTransparency or CONFIG.Transparency,
        Font = self.CurrentFont or CONFIG.Font,
        ShowToggleButton = self.ToggleButton and self.ToggleButton.Visible or true
    }
    CONFIG = tosave
    pcall(function()
        safeWriteFile(CONFIG_PATH, HttpService:JSONEncode(tosave))
    end)
end

function UI:ApplyTransparency(alpha)
    self.CurrentTransparency = alpha
    
    self.MainFrame.BackgroundTransparency = alpha
    self.NavFrame.BackgroundTransparency = alpha
    self.TabContent.BackgroundTransparency = alpha
    
    if self.Header then
        self.Header.BackgroundTransparency = alpha
        if self.Header.Avatar then
            self.Header.Avatar.BackgroundTransparency = alpha + 0.1
        end
    end
    
    for _, tab in pairs(self.Tabs) do
        if tab.NavButton then
            tab.NavButton.BackgroundTransparency = alpha + 0.1
        end
        if tab.Sections then
            for _, s in pairs(tab.Sections) do
                if s.Frame then
                    s.Frame.BackgroundTransparency = alpha + 0.1
                    local h = s.Frame:FindFirstChild("Header")
                    if h then h.BackgroundTransparency = alpha + 0.2 end
                end
            end
        end
    end
    
    self:SaveConfig()
end

function UI:ApplyFont(fontName)
    local fontEnum = UI.FONT_MAP[fontName] or Enum.Font.Gotham
    self.CurrentFont = fontName
    
    local function applyFontRecursive(parent)
        for _, child in pairs(parent:GetChildren()) do
            if child:IsA("TextLabel") or child:IsA("TextButton") then
                child.Font = fontEnum
            end
            applyFontRecursive(child)
        end
    end
    
    applyFontRecursive(self.MainFrame)
    self:SaveConfig()
end

function UI:ApplyTheme(name)
    local theme = UI.THEMES[name]
    if not theme then return end
    self.CurrentThemeName = name

    self.MainFrame.BackgroundColor3 = theme.Main
    self.NavFrame.BackgroundColor3 = theme.Secondary
    self.TabContent.BackgroundColor3 = theme.Main

    if self.Header then
        self.Header.BackgroundColor3 = theme.Secondary
        if self.Header.Title then
            self.Header.Title.TextColor3 = theme.Accent
        end
        if self.Header.Username then
            self.Header.Username.TextColor3 = theme.Text
            self.Header.Welcome.TextColor3 = theme.TextSecondary
        end
    end

    for _, tab in pairs(self.Tabs) do
        if tab.NavButton then
            tab.NavButton.BackgroundColor3 = (self.CurrentTab == tab) and theme.Accent or theme.Border
            local label = tab.NavButton:FindFirstChild("Label")
            if label then label.TextColor3 = (self.CurrentTab == tab) and theme.Text or theme.TextSecondary end
        end
        if tab.Sections then
            for _, s in pairs(tab.Sections) do
                if s.Frame then
                    s.Frame.BackgroundColor3 = theme.Secondary
                    local h = s.Frame:FindFirstChild("Header")
                    if h then h.BackgroundColor3 = theme.Border end
                    for _, child in pairs(s.ElementsFrame:GetChildren()) do
                        if child:IsA("TextButton") or child:IsA("TextLabel") or child:IsA("Frame") then
                            pcall(function()
                                if child:IsA("TextButton") then
                                    child.TextColor3 = theme.Text
                                    child.BackgroundColor3 = theme.Border
                                elseif child:IsA("TextLabel") then
                                    child.TextColor3 = theme.Text
                                end
                            end)
                        end
                    end
                end
            end
        end
    end

    self:ApplyTransparency(self.CurrentTransparency or CONFIG.Transparency)
    self:ApplyFont(self.CurrentFont or CONFIG.Font)
    
    self:SaveConfig()
end

function UI:Init()
    local screen = Instance.new("ScreenGui")
    screen.Name = "SubqInterface"
    screen.ResetOnSpawn = false
    pcall(function() screen.Parent = game:GetService("CoreGui") end)
    if not screen.Parent then
        screen.Parent = LocalPlayer:WaitForChild("PlayerGui")
    end
    self.ScreenGui = screen

    local main = Instance.new("Frame")
    main.Name = "MainFrame"
    main.BackgroundColor3 = UI.THEMES[CONFIG.Theme and CONFIG.Theme or "Dark"].Main
    main.BackgroundTransparency = CONFIG.Transparency or 0.05
    main.BorderSizePixel = 0
    main.Position = UDim2.new(CONFIG.Position and CONFIG.Position.X or 0.22, 0, CONFIG.Position and CONFIG.Position.Y or 0.15, 0)
    main.Size = UDim2.new(0, CONFIG.Size and CONFIG.Size.W or 760, 0, CONFIG.Size and CONFIG.Size.H or 480)
    main.Parent = screen
    main.Active = true
    main.ClipsDescendants = true

    local mainCorner = Instance.new("UICorner")
    mainCorner.CornerRadius = UDim.new(0, 14)
    mainCorner.Parent = main

    self.MainFrame = main

    self:BuildHeader()
    self:BuildNavigation()
    self:BuildContentArea()
    self:BuildResizeGrip()
    self:BuildExternalToggle()
    self:BuildDefaultTabs()

    self:ApplyTheme(CONFIG.Theme or "Dark")
    self:ShowWelcomeOnce("Welcome to Subq Interface Reborn!", 4)

    UserInputService.InputBegan:Connect(function(input, gp)
        if gp then return end
        if input.KeyCode == Enum.KeyCode.RightShift then
            self:ToggleVisibility()
        end
    end)

    self:SetupDrag()
    self:SetupResize()

    self.MainFrame.Visible = CONFIG.Visible ~= false
    if self.ToggleButton then
        self.ToggleButton.Visible = CONFIG.ShowToggleButton ~= false
    end
end

function UI:BuildHeader()
    local header = Instance.new("Frame")
    header.Name = "Header"
    header.Size = UDim2.new(1, 0, 0, 78)
    header.Position = UDim2.new(0, 0, 0, 0)
    header.BackgroundColor3 = UI.THEMES[CONFIG.Theme].Secondary
    header.BackgroundTransparency = CONFIG.Transparency or 0.05
    header.BorderSizePixel = 0
    header.Parent = self.MainFrame

    local headerCorner = Instance.new("UICorner")
    headerCorner.CornerRadius = UDim.new(0, 12)
    headerCorner.Parent = header

    local avatar = Instance.new("ImageLabel")
    avatar.Name = "Avatar"
    avatar.Size = UDim2.new(0, 58, 0, 58)
    avatar.Position = UDim2.new(0, 14, 0, 10)
    avatar.BackgroundColor3 = UI.THEMES[CONFIG.Theme].Border
    avatar.BackgroundTransparency = (CONFIG.Transparency or 0.05) + 0.1
    avatar.BorderSizePixel = 0
    avatar.Parent = header

    local avatarCorner = Instance.new("UICorner")
    avatarCorner.CornerRadius = UDim.new(0, 10)
    avatarCorner.Parent = avatar

    spawn(function()
        pcall(function()
            local thumb = Players:GetUserThumbnailAsync(LocalPlayer.UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
            if thumb then avatar.Image = thumb end
        end)
    end)

    local username = Instance.new("TextLabel")
    username.Name = "Username"
    username.Text = LocalPlayer.DisplayName or LocalPlayer.Name
    username.BackgroundTransparency = 1
    username.Position = UDim2.new(0, 86, 0, 12)
    username.Size = UDim2.new(0, 300, 0, 24)
    username.TextXAlignment = Enum.TextXAlignment.Left
    username.Font = UI.FONT_MAP[CONFIG.Font] or Enum.Font.GothamBold
    username.TextSize = 16
    username.TextColor3 = UI.THEMES[CONFIG.Theme].Text
    username.Parent = header

    local welcome = Instance.new("TextLabel")
    welcome.Name = "Welcome"
    welcome.Text = "Glad to have you"
    welcome.BackgroundTransparency = 1
    welcome.Font = UI.FONT_MAP[CONFIG.Font] or Enum.Font.Gotham
    welcome.TextSize = 12
    welcome.Position = UDim2.new(0, 86, 0, 36)
    welcome.Size = UDim2.new(0, 300, 0, 18)
    welcome.TextXAlignment = Enum.TextXAlignment.Left
    welcome.TextColor3 = UI.THEMES[CONFIG.Theme].TextSecondary
    welcome.Parent = header

    local title = Instance.new("TextLabel")
    title.Name = "Title"
    title.Text = self.Title
    title.BackgroundTransparency = 1
    title.Font = UI.FONT_MAP[CONFIG.Font] or Enum.Font.GothamBold
    title.TextSize = 20
    title.Position = UDim2.new(0.5, -160, 0, 18)
    title.Size = UDim2.new(0, 320, 0, 40)
    title.TextXAlignment = Enum.TextXAlignment.Center
    title.TextColor3 = UI.THEMES[CONFIG.Theme].Accent
    title.Parent = header

    local controls = Instance.new("Frame")
    controls.Name = "Controls"
    controls.Size = UDim2.new(0, 96, 1, 0)
    controls.Position = UDim2.new(1, -110, 0, 0)
    controls.BackgroundTransparency = 1
    controls.Parent = header

    local minimize = Instance.new("ImageButton")
    minimize.Name = "Minimize"
    minimize.Size = UDim2.new(0, 36, 0, 36)
    minimize.Position = UDim2.new(0, 0, 0, 20)
    minimize.Image = ICONS.Minimize
    minimize.BackgroundTransparency = 1
    minimize.Parent = controls
    minimize.AutoButtonColor = true
    minimize.ScaleType = Enum.ScaleType.Fit

    local close = Instance.new("ImageButton")
    close.Name = "Close"
    close.Size = UDim2.new(0, 36, 0, 36)
    close.Position = UDim2.new(0, 48, 0, 20)
    close.Image = ICONS.Close
    close.BackgroundTransparency = 1
    close.Parent = controls
    close.AutoButtonColor = true
    close.ScaleType = Enum.ScaleType.Fit

    minimize.MouseButton1Click:Connect(function()
        self:ToggleMinimize()
    end)
    close.MouseButton1Click:Connect(function()
        self:ToggleVisibility()
    end)

    self.Header = {
        Frame = header,
        Avatar = avatar,
        Username = username,
        Welcome = welcome,
        Title = title,
        Controls = controls
    }
end

function UI:BuildNavigation()
    local nav = Instance.new("Frame")
    nav.Name = "NavFrame"
    nav.Size = UDim2.new(0, 128, 1, -78)
    nav.Position = UDim2.new(0, 0, 0, 78)
    nav.BackgroundColor3 = UI.THEMES[CONFIG.Theme].Secondary
    nav.BackgroundTransparency = CONFIG.Transparency or 0.05
    nav.BorderSizePixel = 0
    nav.Parent = self.MainFrame

    local navCorner = Instance.new("UICorner")
    navCorner.CornerRadius = UDim.new(0, 12)
    navCorner.Parent = nav

    local scroll = Instance.new("ScrollingFrame")
    scroll.Name = "NavScroll"
    scroll.Size = UDim2.new(1, -16, 1, -24)
    scroll.Position = UDim2.new(0, 8, 0, 12)
    scroll.BackgroundTransparency = 1
    scroll.CanvasSize = UDim2.new(0,0,0,0)
    scroll.ScrollBarThickness = 6
    scroll.Parent = nav

    local listLayout = Instance.new("UIListLayout")
    listLayout.Padding = UDim.new(0, 12)
    listLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
    listLayout.Parent = scroll

    listLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
        scroll.CanvasSize = UDim2.new(0,0,0, listLayout.AbsoluteContentSize.Y + 12)
    end)

    self.NavFrame = nav
    self.NavContainer = scroll
end

function UI:BuildContentArea()
    local content = Instance.new("Frame")
    content.Name = "ContentArea"
    content.Size = UDim2.new(1, -128, 1, -78)
    content.Position = UDim2.new(0, 128, 0, 78)
    content.BackgroundColor3 = UI.THEMES[CONFIG.Theme].Main
    content.BackgroundTransparency = CONFIG.Transparency or 0.05
    content.BorderSizePixel = 0
    content.Parent = self.MainFrame

    local contentCorner = Instance.new("UICorner")
    contentCorner.CornerRadius = UDim.new(0, 12)
    contentCorner.Parent = content

    local inner = Instance.new("Frame")
    inner.Name = "Inner"
    inner.Size = UDim2.new(1, -24, 1, -24)
    inner.Position = UDim2.new(0, 12, 0, 12)
    inner.BackgroundTransparency = 1
    inner.Parent = content

    self.ContentArea = content
    self.TabContent = inner
end

function UI:BuildResizeGrip()
    local grip = Instance.new("ImageButton")
    grip.Name = "ResizeGrip"
    grip.Size = UDim2.new(0, 18, 0, 18)
    grip.Position = UDim2.new(1, -22, 1, -22)
    grip.BackgroundTransparency = 1
    grip.Image = ""
    grip.Parent = self.MainFrame
    grip.AutoButtonColor = false

    local gripCorner = Instance.new("UICorner")
    gripCorner.CornerRadius = UDim.new(0, 6)
    gripCorner.Parent = grip

    self.ResizeCorner = grip
end

function UI:BuildExternalToggle()
    local btn = Instance.new("ImageButton")
    btn.Name = "ExternalToggle"
    btn.Size = UDim2.new(0, 54, 0, 54)
    btn.Position = UDim2.new(0, 18, 1, -82)
    btn.BackgroundColor3 = UI.THEMES[CONFIG.Theme].Accent
    btn.BackgroundTransparency = 0.3
    btn.BorderSizePixel = 0
    btn.Parent = self.ScreenGui
    btn.Image = ICONS.ToggleBtn
    btn.AutoButtonColor = true
    btn.Visible = true

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 14)
    corner.Parent = btn

    btn.MouseEnter:Connect(function()
        self:tween(btn, {Size = UDim2.new(0, 60, 0, 60), BackgroundTransparency = 0})
    end)
    btn.MouseLeave:Connect(function()
        self:tween(btn, {Size = UDim2.new(0, 54, 0, 54), BackgroundTransparency = 0.3})
    end)
    btn.MouseButton1Click:Connect(function()
        self:ToggleVisibility()
    end)

    self.ToggleButton = btn
end

function UI:ToggleVisibility()
    self.Visible = not self.Visible
    if self.Visible then
        self.MainFrame.Visible = true
        self.MainFrame.Position = UDim2.new(self.MainFrame.Position.X.Scale, 0, self.MainFrame.Position.Y.Scale, 0)
        self.MainFrame.Size = UDim2.new(0, 0, 0, 0)
        
        self:tween(self.MainFrame, {
            Size = UDim2.new(0, CONFIG.Size.W, 0, CONFIG.Size.H)
        }, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out))
    else
        local currentPos = self.MainFrame.Position
        local currentSize = self.MainFrame.Size
        
        self:tween(self.MainFrame, {
            Size = UDim2.new(0, 0, 0, 0)
        }, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.In))
        
        delay(0.3, function()
            self.MainFrame.Visible = false
            self.MainFrame.Size = currentSize
        end)
    end
    
    if self.ToggleButton then
        self.ToggleButton.BackgroundTransparency = self.Visible and 0.3 or 0.7
    end
    self:SaveConfig()
end

function UI:ToggleMinimize()
    if self.Minimized then
        self:tween(self.MainFrame, {
            Size = UDim2.new(0, CONFIG.Size and CONFIG.Size.W or 760, 0, CONFIG.Size and CONFIG.Size.H or 480)
        }, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out))
        self.Minimized = false
    else
        self:tween(self.MainFrame, {
            Size = UDim2.new(0, CONFIG.Size and 320 or 320, 0, 78)
        }, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out))
        self.Minimized = true
    end
    self:SaveConfig()
end

function UI:AddTab(name, icon)
    local tab = {
        Name = name,
        Icon = icon or ICONS.Home,
        NavButton = nil,
        Content = nil,
        Sections = {}
    }

    local btn = Instance.new("TextButton")
    btn.Name = name .. "_Nav"
    btn.Size = UDim2.new(0, 104, 0, 84)
    btn.BackgroundColor3 = UI.THEMES[CONFIG.Theme].Border
    btn.BackgroundTransparency = (CONFIG.Transparency or 0.05) + 0.1
    btn.BorderSizePixel = 0
    btn.AutoButtonColor = false
    btn.Parent = self.NavContainer
    btn.Text = ""
    btn.LayoutOrder = #self.Tabs + 1

    local bcorner = Instance.new("UICorner")
    bcorner.CornerRadius = UDim.new(0, 10)
    bcorner.Parent = btn

    local img = Instance.new("ImageLabel")
    img.Name = "Icon"
    img.Size = UDim2.new(0, 44, 0, 44)
    img.Position = UDim2.new(0.5, -22, 0, 8)
    img.BackgroundTransparency = 1
    img.Image = icon
    img.Parent = btn
    img.ScaleType = Enum.ScaleType.Fit

    local label = Instance.new("TextLabel")
    label.Name = "Label"
    label.Size = UDim2.new(1, 0, 0, 18)
    label.Position = UDim2.new(0, 0, 0, 54)
    label.BackgroundTransparency = 1
    label.Font = UI.FONT_MAP[CONFIG.Font] or Enum.Font.Gotham
    label.TextColor3 = UI.THEMES[CONFIG.Theme].TextSecondary
    label.TextSize = 12
    label.Text = name
    label.Parent = btn

    local content = Instance.new("ScrollingFrame")
    content.Name = name .. "_Content"
    content.Size = UDim2.new(1, 0, 1, 0)
    content.Position = UDim2.new(0, 0, 0, 0)
    content.BackgroundTransparency = 1
    content.ScrollBarThickness = 6
    content.CanvasSize = UDim2.new(0,0,0,0)
    content.Parent = self.TabContent
    content.Visible = false

    local contentLayout = Instance.new("UIListLayout")
    contentLayout.Padding = UDim.new(0, 12)
    contentLayout.Parent = content

    contentLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
        content.CanvasSize = UDim2.new(0, 0, 0, contentLayout.AbsoluteContentSize.Y + 22)
    end)

    tab.NavButton = btn
    tab.Content = content

    btn.MouseButton1Click:Connect(function()
        self:SwitchTab(tab)
    end)
    btn.MouseEnter:Connect(function()
        if self.CurrentTab ~= tab then
            self:tween(btn, {BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Accent}, TweenInfo.new(0.18))
            label.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
        end
    end)
    btn.MouseLeave:Connect(function()
        if self.CurrentTab ~= tab then
            self:tween(btn, {BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border}, TweenInfo.new(0.18))
            label.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].TextSecondary
        end
    end)

    table.insert(self.Tabs, tab)
    if #self.Tabs == 1 then
        self:SwitchTab(tab)
    end

    return tab
end

function UI:SwitchTab(tab)
    for _, t in pairs(self.Tabs) do
        t.Content.Visible = false
        t.NavButton.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border
        local lbl = t.NavButton:FindFirstChild("Label")
        if lbl then lbl.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].TextSecondary end
    end
    
    if self.CurrentTab and self.CurrentTab.Content then
        self:tween(self.CurrentTab.Content, {Position = UDim2.new(-0.2, 0, 0, 0)}, TweenInfo.new(0.2))
    end
    
    tab.Content.Visible = true
    tab.Content.Position = UDim2.new(0.2, 0, 0, 0)
    self:tween(tab.Content, {Position = UDim2.new(0, 0, 0, 0)}, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out))
    
    tab.NavButton.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Accent
    local lbl = tab.NavButton:FindFirstChild("Label")
    if lbl then lbl.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text end
    self.CurrentTab = tab
    self:ApplyTheme(self.CurrentThemeName or CONFIG.Theme)
end

function UI:AddSection(tab, title)
    local section = {}
    section.Title = title
    local frame = Instance.new("Frame")
    frame.Name = title .. "_Section"
    frame.Size = UDim2.new(1, 0, 0, 40)
    frame.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Secondary
    frame.BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.1
    frame.BorderSizePixel = 0
    frame.Parent = tab.Content

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 10)
    corner.Parent = frame

    local header = Instance.new("Frame")
    header.Name = "Header"
    header.Size = UDim2.new(1, 0, 0, 36)
    header.Position = UDim2.new(0, 0, 0, 0)
    header.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border
    header.BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.2
    header.Parent = frame

    local hcorner = Instance.new("UICorner")
    hcorner.CornerRadius = UDim.new(0, 10)
    hcorner.Parent = header

    local label = Instance.new("TextLabel")
    label.Name = "Title"
    label.Text = title
    label.Size = UDim2.new(1, -24, 1, 0)
    label.Position = UDim2.new(0, 12, 0, 0)
    label.BackgroundTransparency = 1
    label.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.GothamBold
    label.TextSize = 14
    label.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = header

    local elements = Instance.new("Frame")
    elements.Name = "Elements"
    elements.Position = UDim2.new(0, 0, 0, 44)
    elements.Size = UDim2.new(1, 0, 0, 0)
    elements.BackgroundTransparency = 1
    elements.Parent = frame

    local layout = Instance.new("UIListLayout")
    layout.Padding = UDim.new(0, 10)
    layout.Parent = elements

    layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
        elements.Size = UDim2.new(1, 0, 0, layout.AbsoluteContentSize.Y)
        frame.Size = UDim2.new(1, 0, 0, layout.AbsoluteContentSize.Y + 54)
    end)

    section.Frame = frame
    section.ElementsFrame = elements
    section.ElementsLayout = layout
    table.insert(tab.Sections, section)
    return section
end

function UI:CreateButton(section, title, description, callback)
    local btnWrapper = Instance.new("Frame")
    btnWrapper.Name = title .. "_ButtonWrapper"
    btnWrapper.Size = UDim2.new(1, 0, 0, 58)
    btnWrapper.BackgroundTransparency = 1
    btnWrapper.Parent = section.ElementsFrame

    local button = Instance.new("TextButton")
    button.Name = title .. "_Button"
    button.Text = title
    button.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    button.TextSize = 14
    button.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    button.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border
    button.BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.1
    button.BorderSizePixel = 0
    button.Size = UDim2.new(1, 0, 0, 36)
    button.Parent = btnWrapper
    button.AutoButtonColor = false

    local bcorner = Instance.new("UICorner")
    bcorner.CornerRadius = UDim.new(0, 8)
    bcorner.Parent = button

    local desc = Instance.new("TextLabel")
    desc.Name = "Description"
    desc.Text = description or ""
    desc.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    desc.TextSize = 12
    desc.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].TextSecondary
    desc.BackgroundTransparency = 1
    desc.TextWrapped = true
    desc.Size = UDim2.new(1, 0, 0, 18)
    desc.Position = UDim2.new(0, 0, 0, 38)
    desc.TextXAlignment = Enum.TextXAlignment.Left
    desc.Parent = btnWrapper

    button.MouseEnter:Connect(function()
        self:tween(button, {
            BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Accent,
            Size = UDim2.new(1, -4, 0, 36)
        }, TweenInfo.new(0.18))
    end)
    button.MouseLeave:Connect(function()
        self:tween(button, {
            BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border,
            Size = UDim2.new(1, 0, 0, 36)
        }, TweenInfo.new(0.18))
    end)

    button.MouseButton1Click:Connect(function()
        self:tween(button, {BackgroundTransparency = 0.5}, TweenInfo.new(0.1))
        self:tween(button, {BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.1}, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0.1))
        
        if callback then
            callback()
        end
    end)

    return button
end

function UI:CreateToggle(section, text, description, default, callback)
    local wrapper = Instance.new("Frame")
    wrapper.Name = text .. "_ToggleWrapper"
    wrapper.Size = UDim2.new(1, 0, 0, 52)
    wrapper.BackgroundTransparency = 1
    wrapper.Parent = section.ElementsFrame

    local label = Instance.new("TextLabel")
    label.Name = "Label"
    label.Text = text
    label.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    label.TextSize = 14
    label.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    label.Size = UDim2.new(0.74, 0, 0, 36)
    label.Position = UDim2.new(0, 12, 0, 6)
    label.BackgroundTransparency = 1
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = wrapper

    local desc = Instance.new("TextLabel")
    desc.Name = "Desc"
    desc.Text = description or ""
    desc.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    desc.TextSize = 12
    desc.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].TextSecondary
    desc.BackgroundTransparency = 1
    desc.TextWrapped = true
    desc.Size = UDim2.new(0.74, 0, 0, 16)
    desc.Position = UDim2.new(0, 12, 0, 30)
    desc.TextXAlignment = Enum.TextXAlignment.Left
    desc.Parent = wrapper

    local switch = Instance.new("TextButton")
    switch.Name = "Switch"
    switch.Size = UDim2.new(0, 68, 0, 30)
    switch.Position = UDim2.new(1, -86, 0, 11)
    switch.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border
    switch.BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.1
    switch.BorderSizePixel = 0
    switch.AutoButtonColor = false
    switch.Parent = wrapper

    local scorner = Instance.new("UICorner")
    scorner.CornerRadius = UDim.new(0, 16)
    scorner.Parent = switch

    local knob = Instance.new("Frame")
    knob.Name = "Knob"
    knob.Size = UDim2.new(0, 18, 0, 18)
    knob.Position = UDim2.new(0, 6, 0, 6)
    knob.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    knob.BorderSizePixel = 0
    knob.Parent = switch

    local kcorner = Instance.new("UICorner")
    kcorner.CornerRadius = UDim.new(0, 9)
    kcorner.Parent = knob

    local state = default or false
    local function updateVisual()
        if state then
            self:tween(switch, {
                BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Accent,
                BackgroundTransparency = 0
            }, TweenInfo.new(0.2))
            self:tween(knob, {Position = UDim2.new(1, -24, 0, 6)}, TweenInfo.new(0.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out))
        else
            self:tween(switch, {
                BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border,
                BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.1
            }, TweenInfo.new(0.2))
            self:tween(knob, {Position = UDim2.new(0, 6, 0, 6)}, TweenInfo.new(0.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out))
        end
    end

    switch.MouseButton1Click:Connect(function()
        state = not state
        updateVisual()
        if callback then callback(state) end
    end)

    updateVisual()

    return {
        Set = function(s) state = s updateVisual() end,
        Get = function() return state end
    }
end

function UI:CreateSlider(section, text, description, min, max, default, callback)
    local wrapper = Instance.new("Frame")
    wrapper.Name = text .. "_SliderWrapper"
    wrapper.Size = UDim2.new(1, 0, 0, 72)
    wrapper.BackgroundTransparency = 1
    wrapper.Parent = section.ElementsFrame

    local title = Instance.new("TextLabel")
    title.Name = "Title"
    title.Text = text .. ": " .. tostring(default)
    title.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    title.TextSize = 14
    title.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    title.BackgroundTransparency = 1
    title.Size = UDim2.new(1, -80, 0, 24)
    title.Position = UDim2.new(0, 12, 0, 6)
    title.TextXAlignment = Enum.TextXAlignment.Left
    title.Parent = wrapper

    local val = Instance.new("TextLabel")
    val.Name = "Value"
    val.Text = tostring(default)
    val.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    val.TextSize = 14
    val.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Accent
    val.BackgroundTransparency = 1
    val.Size = UDim2.new(0, 64, 0, 24)
    val.Position = UDim2.new(1, -72, 0, 6)
    val.TextXAlignment = Enum.TextXAlignment.Right
    val.Parent = wrapper

    local track = Instance.new("TextButton")
    track.Name = "Track"
    track.Size = UDim2.new(1, -24, 0, 12)
    track.Position = UDim2.new(0, 12, 0, 36)
    track.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Border
    track.BackgroundTransparency = (self.CurrentTransparency or CONFIG.Transparency) + 0.1
    track.BorderSizePixel = 0
    track.AutoButtonColor = false
    track.Parent = wrapper

    local tcorner = Instance.new("UICorner")
    tcorner.CornerRadius = UDim.new(0, 6)
    tcorner.Parent = track

    local fill = Instance.new("Frame")
    fill.Name = "Fill"
    fill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
    fill.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Accent
    fill.BorderSizePixel = 0
    fill.Parent = track

    local fcorner = Instance.new("UICorner")
    fcorner.CornerRadius = UDim.new(0, 6)
    fcorner.Parent = fill

    local handle = Instance.new("ImageButton")
    handle.Name = "Handle"
    handle.Size = UDim2.new(0, 16, 0, 16)
    handle.Position = UDim2.new((default - min) / (max - min), -8, 0.5, -8)
    handle.BackgroundColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    handle.BorderSizePixel = 0
    handle.Parent = wrapper
    handle.AutoButtonColor = false

    local hcorner = Instance.new("UICorner")
    hcorner.CornerRadius = UDim.new(0, 8)
    hcorner.Parent = handle

    local dragging = false
    local value = default

    local function updateFromInput(input)
        local abs = track.AbsolutePosition
        local size = track.AbsoluteSize
        local relative = (input.Position.X - abs.X) / size.X
        relative = math.clamp(relative, 0, 1)
        value = math.floor(min + (max - min) * relative)
        title.Text = text .. ": " .. tostring(value)
        val.Text = tostring(value)
        
        self:tween(fill, {Size = UDim2.new(relative, 0, 1, 0)}, TweenInfo.new(0.1))
        self:tween(handle, {Position = UDim2.new(relative, -8, 0.5, -8)}, TweenInfo.new(0.1))
        
        if callback then callback(value) end
    end

    handle.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            self:tween(handle, {Size = UDim2.new(0, 20, 0, 20)}, TweenInfo.new(0.1))
        end
    end)
    UserInputService.InputEnded:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = false
            self:tween(handle, {Size = UDim2.new(0, 16, 0, 16)}, TweenInfo.new(0.1))
        end
    end)
    UserInputService.InputChanged:Connect(function(input)
        if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
            pcall(function() updateFromInput(input) end)
        end
    end)
    track.MouseButton1Down:Connect(function(input)
        pcall(function() updateFromInput(input) end)
    end)

    return {
        Set = function(newVal)
            value = math.clamp(newVal, min, max)
            local rel = (value - min) / (max - min)
            title.Text = text .. ": " .. tostring(value)
            val.Text = tostring(value)
            self:tween(fill, {Size = UDim2.new(rel, 0, 1, 0)}, TweenInfo.new(0.2))
            self:tween(handle, {Position = UDim2.new(rel, -8, 0.5, -8)}, TweenInfo.new(0.2))
            if callback then callback(value) end
        end,
        Get = function() return value end
    }
end

function UI:ShowWelcomeOnce(text, duration)
    duration = duration or 3
    if self._welcomeShown then return end
    self._welcomeShown = true

    local theme = UI.THEMES[self.CurrentThemeName or CONFIG.Theme]
    
    local notif = Instance.new("Frame")
    notif.Name = "WelcomeNotif"
    notif.Size = UDim2.new(0, 380, 0, 92)
    notif.Position = UDim2.new(1, -400, 1, -140)
    notif.BackgroundColor3 = theme.Secondary
    notif.BackgroundTransparency = 0.1
    notif.BorderSizePixel = 0
    notif.Parent = self.ScreenGui
    notif.ZIndex = 2000

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 16)
    corner.Parent = notif

    local title = Instance.new("TextLabel")
    title.Name = "Title"
    title.Text = "Welcome"
    title.BackgroundTransparency = 1
    title.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.GothamBold
    title.TextSize = 16
    title.TextColor3 = theme.Accent
    title.Position = UDim2.new(0, 16, 0, 12)
    title.Size = UDim2.new(1, -32, 0, 24)
    title.TextXAlignment = Enum.TextXAlignment.Left
    title.Parent = notif

    local msg = Instance.new("TextLabel")
    msg.Name = "Message"
    msg.Text = text
    msg.BackgroundTransparency = 1
    msg.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    msg.TextSize = 14
    msg.TextColor3 = theme.Text
    msg.TextWrapped = true
    msg.Position = UDim2.new(0, 16, 0, 38)
    msg.Size = UDim2.new(1, -32, 0, 44)
    msg.TextXAlignment = Enum.TextXAlignment.Left
    msg.Parent = notif

    notif.Position = UDim2.new(1, 420, 1, -140)
    self:tween(notif, {
        Position = UDim2.new(1, -400, 1, -140)
    }, TweenInfo.new(0.6, Enum.EasingStyle.Back, Enum.EasingDirection.Out))
    
    delay(duration, function()
        self:tween(notif, {
            Position = UDim2.new(1, 420, 1, -140)
        }, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.In))
        delay(0.45, function()
            pcall(function() notif:Destroy() end)
        end)
    end)
end

function UI:BuildDefaultTabs()
    local mainTab = self:AddTab("Main", ICONS.Home)
    self.MainTab = mainTab
    local utilities = self:AddSection(mainTab, "Utilities")
    self:CreateButton(utilities, "Refresh Game", "Restart local elements (client-side refresh)", function()
        self:ShowWelcomeOnce("Local refresh executed", 2)
    end)
    self:CreateButton(utilities, "Server Info", "Show server & player details", function()
        local players = #Players:GetPlayers()
        self:ShowWelcomeOnce("Players online: " .. tostring(players), 3)
    end)

    local quick = self:AddSection(mainTab, "Quick Actions")
    self:CreateButton(quick, "Teleport to Spawn", "Teleport to spawn if available", function()
        if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
            local spawn = workspace:FindFirstChild("SpawnLocation") or workspace:FindFirstChildOfClass("Part")
            if spawn then
                LocalPlayer.Character.HumanoidRootPart.CFrame = spawn.CFrame + Vector3.new(0,3,0)
                self:ShowWelcomeOnce("Teleported to spawn", 2)
            else
                self:ShowWelcomeOnce("Spawn not found", 2)
            end
        end
    end)

    local playerTab = self:AddTab("Player", ICONS.Player)
    self.PlayerTab = playerTab
    local movement = self:AddSection(playerTab, "Movement")
    local fly = self:CreateToggle(movement, "Fly Mode", "Enable flying (WASD + Space + Shift)", false, function(state)
        self.FlyEnabled = state
        if state then
            self:ShowWelcomeOnce("Fly enabled", 2)
        else
            self:ShowWelcomeOnce("Fly disabled", 2)
        end
    end)
    local speedS = self:CreateSlider(movement, "Walk Speed", "Adjust WalkSpeed (client)", 16, 300, 16, function(val)
        if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid") then
            LocalPlayer.Character.Humanoid.WalkSpeed = val
        end
    end)
    local jumpS = self:CreateSlider(movement, "Jump Power", "Adjust JumpPower (client)", 50, 300, 50, function(val)
        if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid") then
            LocalPlayer.Character.Humanoid.JumpPower = val
        end
    end)

    local visuals = self:AddTab("Visuals", ICONS.Visuals)
    self.VisualsTab = visuals
    local render = self:AddSection(visuals, "Rendering")
    self:CreateToggle(render, "Full Bright", "Temporarily adjust lighting (client-side)", false, function(state)
        if state then
            pcall(function()
                game:GetService("Lighting").Brightness = 2
                game:GetService("Lighting").ClockTime = 14
            end)
            self:ShowWelcomeOnce("Full Bright enabled (client)", 2)
        else
            pcall(function()
                game:GetService("Lighting").Brightness = 1
                game:GetService("Lighting").ClockTime = 12
            end)
            self:ShowWelcomeOnce("Full Bright disabled", 2)
        end
    end)
    local fx = self:AddSection(visuals, "Effects")
    self:CreateToggle(fx, "Show FOV Circle", "Toggle aim FOV indicator (placeholder)", false, function(state)
        self:ShowWelcomeOnce(state and "FOV shown" or "FOV hidden", 1.5)
    end)

    local settings = self:AddTab("Settings", ICONS.Settings)
    self.SettingsTab = settings
    local themeSec = self:AddSection(settings, "Themes")
    for themeName, _ in pairs(UI.THEMES) do
        self:CreateButton(themeSec, themeName .. " Theme", "Apply the "..themeName.." theme", function()
            self:ApplyTheme(themeName)
            self:ShowWelcomeOnce(themeName .. " applied", 2)
        end)
    end
    
    local transparencySec = self:AddSection(settings, "Transparency")
    local transparencySlider = self:CreateSlider(transparencySec, "UI Transparency", "Adjust interface transparency", 0, 80, math.floor((CONFIG.Transparency or 0.05) * 100), function(val)
        self:ApplyTransparency(val / 100)
        self:ShowWelcomeOnce("Transparency: " .. val .. "%", 1.5)
    end)
    
    local fontSec = self:AddSection(settings, "Fonts")
    for fontName, _ in pairs(UI.FONT_MAP) do
        self:CreateButton(fontSec, fontName, "Use " .. fontName .. " font", function()
            self:ApplyFont(fontName)
            self:ShowWelcomeOnce("Font: " .. fontName, 1.5)
        end)
    end
    
    local iface = self:AddSection(settings, "Interface")
    self:CreateToggle(iface, "Show Toggle Button", "Show/hide the external toggle button", CONFIG.ShowToggleButton ~= false, function(state)
        if self.ToggleButton then
            self.ToggleButton.Visible = state
        end
        self:SaveConfig()
    end)
    self:CreateButton(iface, "Save Layout", "Save current position & size", function()
        self:SaveConfig()
        self:ShowWelcomeOnce("Layout saved", 1.5)
    end)
    self:CreateButton(iface, "Reset Layout", "Reset to default position & size", function()
        pcall(function()
            safeWriteFile(CONFIG_PATH, HttpService:JSONEncode(DEFAULT_CONFIG))
        end)
        self.MainFrame.Position = UDim2.new(DEFAULT_CONFIG.Position.X, 0, DEFAULT_CONFIG.Position.Y, 0)
        self.MainFrame.Size = UDim2.new(0, DEFAULT_CONFIG.Size.W, 0, DEFAULT_CONFIG.Size.H)
        self:ApplyTheme(DEFAULT_CONFIG.Theme)
        self:ApplyTransparency(DEFAULT_CONFIG.Transparency)
        self:ApplyFont(DEFAULT_CONFIG.Font)
        self:ShowWelcomeOnce("Layout reset", 1.5)
    end)

    local info = self:AddTab("Information", ICONS.Info)
    self.InfoTab = info
    local welcome = self:AddSection(info, "Welcome")
    local infoText = Instance.new("TextLabel")
    infoText.Name = "InfoText"
    infoText.Size = UDim2.new(1, 0, 0, 180)
    infoText.BackgroundTransparency = 1
    infoText.TextWrapped = true
    infoText.TextXAlignment = Enum.TextXAlignment.Left
    infoText.TextYAlignment = Enum.TextYAlignment.Top
    infoText.Font = UI.FONT_MAP[self.CurrentFont or CONFIG.Font] or Enum.Font.Gotham
    infoText.TextSize = 14
    infoText.TextColor3 = UI.THEMES[self.CurrentThemeName or CONFIG.Theme].Text
    infoText.Text = "Welcome to Subq Interface Reborn!\n\nThis UI is built to be fully customizable:\n• Replace icon IDs in the ICONS table at top\n• Change themes, save layout, and resize the window\n• Controls: RightShift toggles UI\n\nEnjoy!"
    infoText.Parent = welcome.ElementsFrame

    local extras = self:AddSection(info, "Links & Credits")
    self:CreateButton(extras, "Icons Guide", "Good sources: icons8, svgrepo, lucide.dev", function()
        self:ShowWelcomeOnce("Icons: icons8.com, svgrepo.com, lucide.dev", 3)
    end)
end

function UI:SetupDrag()
    local header = self.Header and self.Header.Frame
    if not header then return end
    local dragging = false
    local dragStart = nil
    local startPos = nil
    local dragInput = nil

    header.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            dragStart = input.Position
            startPos = self.MainFrame.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                    local pos = self.MainFrame.Position
                    CONFIG.Position = {X = pos.X.Scale, Y = pos.Y.Scale}
                    pcall(function() safeWriteFile(CONFIG_PATH, HttpService:JSONEncode({
                        Visible = self.Visible,
                        Position = CONFIG.Position,
                        Size = {W = self.MainFrame.Size.X.Offset, H = self.MainFrame.Size.Y.Offset},
                        Theme = self.CurrentThemeName or CONFIG.Theme,
                        Transparency = self.CurrentTransparency or CONFIG.Transparency,
                        Font = self.CurrentFont or CONFIG.Font,
                        ShowToggleButton = self.ToggleButton and self.ToggleButton.Visible or true
                    })) end)
                end
            end)
        end
    end)

    header.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement then
            dragInput = input
        end
    end)

    UserInputService.InputChanged:Connect(function(input)
        if input == dragInput and dragging then
            local delta = input.Position - dragStart
            local newPos = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
            self.MainFrame.Position = newPos
        end
    end)
end

function UI:SetupResize()
    local grip = self.ResizeCorner
    if not grip then return end
    local resizing = false
    local startPos, startSize, mouseStart

    grip.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            resizing = true
            startSize = {W = self.MainFrame.Size.X.Offset, H = self.MainFrame.Size.Y.Offset}
            mouseStart = input.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    resizing = false
                    CONFIG.Size = {W = self.MainFrame.Size.X.Offset, H = self.MainFrame.Size.Y.Offset}
                    pcall(function() safeWriteFile(CONFIG_PATH, HttpService:JSONEncode({
                        Visible = self.Visible,
                        Position = {X = self.MainFrame.Position.X.Scale, Y = self.MainFrame.Position.Y.Scale},
                        Size = CONFIG.Size,
                        Theme = self.CurrentThemeName or CONFIG.Theme,
                        Transparency = self.CurrentTransparency or CONFIG.Transparency,
                        Font = self.CurrentFont or CONFIG.Font,
                        ShowToggleButton = self.ToggleButton and self.ToggleButton.Visible or true
                    })) end)
                end
            end)
        end
    end)

    UserInputService.InputChanged:Connect(function(input)
        if resizing and input.UserInputType == Enum.UserInputType.MouseMovement then
            local delta = input.Position - mouseStart
            local newW = math.max(480, startSize.W + delta.X)
            local newH = math.max(320, startSize.H + delta.Y)
            self.MainFrame.Size = UDim2.new(0, newW, 0, newH)
        end
    end)
end

local SUBQ = UI.new("Subq Interface Reborn")

Features & Information

This UI took less than 30 minutes to make, made with chatgpt and deepseek
#ui#chatgpt#deepsek

Community Comments (4)

Sander_NLSander_NLOct 16, 2025

this isnt a ui library

Replying to @Sander_NL
subqsubqOct 17, 2025

@Sander_NL ui"

Replying to @subq
Sander_NLSander_NLOct 18, 2025

@subq yeah

FLg1xFLg1xMay 29, 2026

would be better if you add the API function to add deepseek API and ask him mid game

More Scripts for Universal Scripts