Nox - Deprecated
Key RequiredUniversal

Nox - Deprecated

Universal Scriptnotfynnnnotfynnn 795 views 1.2K executesUpdated Jun 30, 2026
2.5/ 5(2 votes)
1150% Positive
Lua Script•1307 lines (51095 chars)
local tw = game:GetService("TweenService")
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local plrs = game:GetService("Players")
local cg = game:GetService("CoreGui")
local http = game:GetService("HttpService")

local folderName = "M3 Lib Assets"
local jsonName = "m3font.json"
local ttfName = "GoogleSans.ttf"
local fontUrl = "https://github.com/fiangg20/Fian_gg-Repo/raw/refs/heads/main/GoogleSansFlex_24pt-Regular.ttf"

if not isfolder(folderName) then makefolder(folderName) end

if not isfile(folderName .. "/" .. ttfName) then
    local fontFile = game:HttpGet(fontUrl)
    writefile(folderName .. "/" .. ttfName, fontFile)
end

local assetURL = getcustomasset(folderName .. "/" .. ttfName)
local fontJsonData = {
    name = "CustomFamily_GoogleSans",
    faces = {
        {
            name = "Regular",
            weight = 400,
            style = "normal",
            assetId = assetURL
        }
    }
}

local pathJSON = folderName .. "/" .. jsonName
writefile(pathJSON, http:JSONEncode(fontJsonData))
local m3Font = Font.new(getcustomasset(pathJSON))

local m3Gray = Color3.fromRGB(202, 196, 208)

local cp = {
    ["Purple"] = {bg=Color3.fromRGB(28,27,31), fg=Color3.fromRGB(230,225,229), pri=Color3.fromRGB(208,188,255), onpri=Color3.fromRGB(56,30,114), inact=Color3.fromRGB(43,41,48), out=Color3.fromRGB(147,143,153)},
    ["Blue"] = {bg=Color3.fromRGB(26,28,30), fg=Color3.fromRGB(226,226,230), pri=Color3.fromRGB(162,201,255), onpri=Color3.fromRGB(0,50,90), inact=Color3.fromRGB(40,42,46), out=Color3.fromRGB(141,145,153)},
    ["Red"] = {bg=Color3.fromRGB(32,26,25), fg=Color3.fromRGB(237,224,222), pri=Color3.fromRGB(255,180,168), onpri=Color3.fromRGB(105,0,5), inact=Color3.fromRGB(50,40,38), out=Color3.fromRGB(160,140,137)},
    ["Green"] = {bg=Color3.fromRGB(26,28,25), fg=Color3.fromRGB(225,227,223), pri=Color3.fromRGB(143,215,135), onpri=Color3.fromRGB(0,57,10), inact=Color3.fromRGB(40,43,40), out=Color3.fromRGB(142,145,143)},
    ["Orange"] = {bg=Color3.fromRGB(32,27,24), fg=Color3.fromRGB(236,224,219), pri=Color3.fromRGB(255,183,123), onpri=Color3.fromRGB(76,38,0), inact=Color3.fromRGB(50,42,38), out=Color3.fromRGB(159,141,132)},
    ["PitchBlack"] = {bg=Color3.fromRGB(0,0,0), fg=Color3.fromRGB(230,225,229), pri=Color3.fromRGB(208,188,255), onpri=Color3.fromRGB(56,30,114), inact=Color3.fromRGB(28,28,30), out=Color3.fromRGB(147,143,153)}
}

local curTheme = cp["Blue"]
local objs = {bg={}, fg={}, pri={}, onpri={}, inact={}, out={}, s_trk={}, s_thm={}, tab_btn={}, tbox={}, icon={}, dlg_bg={}, dlg_fg={}, sl_val={}}

local function t(o, p, v, d)
    tw:Create(o, TweenInfo.new(d or 0.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {[p] = v}):Play()
end

local function CreateM3UI(titleText, sizeX, sizeY)
    local lib = {}
    local resizeHandle 

    local old = cg:FindFirstChild(titleText or "Nox")
    if old then old:Destroy() end

    local gui = Instance.new("ScreenGui")
    gui.Name = titleText or "Nox"
    gui.IgnoreGuiInset = true
    gui.ResetOnSpawn = false
    gui.DisplayOrder = 1e6
    gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
    gui.Parent = cg

    local win = Instance.new("Frame", gui)
    win.Size = UDim2.new(0, sizeX or 380, 0, sizeY or 520)
    win.Position = UDim2.new(0.5, -sizeX/2, 0.5, -sizeY/2)
    win.BackgroundColor3 = curTheme.bg
    win.BorderSizePixel = 0
    win.ClipsDescendants = true
    table.insert(objs.bg, win)
    Instance.new("UICorner", win).CornerRadius = UDim.new(0, 16)

    local top = Instance.new("TextLabel", win)
    top.Size = UDim2.new(1, -120, 0, 45) 
    top.Position = UDim2.new(0, 24, 0, 10)
    top.BackgroundTransparency = 1
    top.Text = titleText or "Nameless UI"
    top.TextColor3 = curTheme.fg
    top.FontFace = Font.new(m3Font.Family, Enum.FontWeight.Medium, Enum.FontStyle.Normal)
    top.TextSize = 22
    top.TextXAlignment = Enum.TextXAlignment.Left
    table.insert(objs.fg, top)

    local ctrlCont = Instance.new("Frame", win)
    ctrlCont.Size = UDim2.new(0, 100, 0, 32)
    ctrlCont.AnchorPoint = Vector2.new(1, 0)
    ctrlCont.Position = UDim2.new(1, -12, 0, 16) 
    ctrlCont.BackgroundTransparency = 1

    local ctrlLayout = Instance.new("UIListLayout", ctrlCont)
    ctrlLayout.FillDirection = Enum.FillDirection.Horizontal
    ctrlLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
    ctrlLayout.SortOrder = Enum.SortOrder.LayoutOrder
    ctrlLayout.Padding = UDim.new(0, 8)

    local function createCtrlBtn(name, icon)
        local btn = Instance.new("TextButton", ctrlCont)
        btn.Name = name
        btn.Size = UDim2.new(0, 32, 0, 32)
        btn.BackgroundTransparency = 1
        btn.Text = ""
        Instance.new("UICorner", btn).CornerRadius = UDim.new(1, 0)
        
        local icn = Instance.new("ImageLabel", btn)
        icn.Size = UDim2.new(0, 18, 0, 18)
        icn.AnchorPoint = Vector2.new(0.5, 0.5)
        icn.Position = UDim2.new(0.5, 0, 0.5, 0)
        icn.BackgroundTransparency = 1
        icn.Image = icon
        icn.ImageColor3 = curTheme.out
        table.insert(objs.icon, icn)

        btn.MouseEnter:Connect(function() 
            t(btn, "BackgroundTransparency", 0.9, 0.2)
            t(btn, "BackgroundColor3", curTheme.out, 0.2)
        end)
        btn.MouseLeave:Connect(function() 
            t(btn, "BackgroundTransparency", 1, 0.2) 
        end)
        
        return btn, icn
    end

    local iconMin = "rbxassetid://111317703462067" 
    local iconMax = "rbxassetid://124475854066414" 
    local iconClose = "rbxassetid://117872438909014" 

    local btnMinMax, icnMinMax = createCtrlBtn("Minimize and Maximize", iconMin)
    local btnClose, icnClose = createCtrlBtn("Close", iconClose)

    local isMin = false
    local isMax = false
    local preSize = win.Size
    local prePos = win.Position

    btnMinMax.MouseButton1Click:Connect(function()
        if isMin then
            isMin = false
            icnMinMax.Image = iconMin
            t(win, "Size", preSize, 0.4)
            if resizeHandle then resizeHandle.Visible = true end
        else
            if not isMax then preSize = win.Size end
            isMin = true
            isMax = false
            icnMinMax.Image = iconMax
            t(win, "Size", UDim2.new(0, win.Size.X.Offset, 0, 64), 0.4)
            if resizeHandle then resizeHandle.Visible = false end
        end
    end)

    btnClose.MouseButton1Click:Connect(function()
        gui:Destroy()
    end)

    local tabArea = Instance.new("Frame", win)
    tabArea.Size = UDim2.new(1, 0, 0, 40) 
    tabArea.Position = UDim2.new(0, 0, 0, 55) 
    tabArea.BackgroundTransparency = 1
    tabArea.ClipsDescendants = true
    tabArea.Visible = false

    local sep = Instance.new("Frame", tabArea)
    sep.Size = UDim2.new(1, 0, 0, 1)
    sep.AnchorPoint = Vector2.new(0, 1)
    sep.Position = UDim2.new(0, 0, 1, 0)
    sep.BackgroundColor3 = curTheme.inact
    sep.BorderSizePixel = 0
    table.insert(objs.inact, sep)

    local tabListCont = Instance.new("ScrollingFrame", tabArea)
    tabListCont.Size = UDim2.new(1, 0, 1, 0)
    tabListCont.BackgroundTransparency = 1
    tabListCont.ScrollBarThickness = 0
    tabListCont.CanvasSize = UDim2.new(0, 0, 0, 0)
    tabListCont.AutomaticCanvasSize = Enum.AutomaticSize.X

    local dragTab = false
    local isDraggingTabAction = false
    local dragTabStartX = 0
    local dragTabStartCanvasX = 0

    local function startTabDrag(input)
        if input.UserInputType.Name:find("MouseButton1") or input.UserInputType.Name:find("Touch") then
            dragTab = true
            isDraggingTabAction = false
            dragTabStartX = input.Position.X
            dragTabStartCanvasX = tabListCont.CanvasPosition.X
        end
    end

    tabListCont.InputBegan:Connect(startTabDrag)

    uis.InputChanged:Connect(function(input)
        if dragTab and (input.UserInputType.Name:find("MouseMovement") or input.UserInputType.Name:find("Touch")) then
            local delta = dragTabStartX - input.Position.X
            if math.abs(delta) > 5 then
                isDraggingTabAction = true
                tabListCont.CanvasPosition = Vector2.new(dragTabStartCanvasX + delta, 0)
            end
        end
    end)

    uis.InputEnded:Connect(function(input)
        if input.UserInputType.Name:find("MouseButton1") or input.UserInputType.Name:find("Touch") then
            dragTab = false
        end
    end)

    local tabListInner = Instance.new("Frame", tabListCont)
    tabListInner.Size = UDim2.new(1, 0, 1, 0)
    tabListInner.BackgroundTransparency = 1
    tabListInner.AutomaticSize = Enum.AutomaticSize.X

    local tPad = Instance.new("UIPadding", tabListInner)
    tPad.PaddingLeft = UDim.new(0, 24)
    tPad.PaddingRight = UDim.new(0, 24)

    local tabList = Instance.new("UIListLayout", tabListInner)
    tabList.FillDirection = Enum.FillDirection.Horizontal
    tabList.SortOrder = Enum.SortOrder.LayoutOrder
    tabList.HorizontalAlignment = Enum.HorizontalAlignment.Center
    tabList.Padding = UDim.new(0, 12)

    local indicator = Instance.new("Frame", tabListCont)
    indicator.Size = UDim2.new(0, 0, 0, 3)
    indicator.AnchorPoint = Vector2.new(0.5, 1)
    indicator.Position = UDim2.new(0, 0, 1, 0)
    indicator.BackgroundColor3 = curTheme.pri
    Instance.new("UICorner", indicator).CornerRadius = UDim.new(1, 0)
    table.insert(objs.pri, indicator)

    local defaultCont = Instance.new("ScrollingFrame", win)
    defaultCont.Size = UDim2.new(1, 0, 1, -70)
    defaultCont.Position = UDim2.new(0, 0, 0, 60)
    defaultCont.BackgroundTransparency = 1
    defaultCont.ScrollBarThickness = 0
    defaultCont.CanvasSize = UDim2.new(0, 0, 0, 0)
    defaultCont.AutomaticCanvasSize = Enum.AutomaticSize.Y
    
    local dPad = Instance.new("UIPadding", defaultCont)
    dPad.PaddingLeft = UDim.new(0, 24)
    dPad.PaddingRight = UDim.new(0, 24)
    dPad.PaddingBottom = UDim.new(0, 20)
    dPad.PaddingTop = UDim.new(0, 20)

    local defLayout = Instance.new("UIListLayout", defaultCont)
    defLayout.SortOrder = Enum.SortOrder.LayoutOrder
    defLayout.Padding = UDim.new(0, 18)

    local contClip = Instance.new("Frame", win)
    contClip.Size = UDim2.new(1, 0, 1, -100)
    contClip.Position = UDim2.new(0, 0, 0, 100)
    contClip.BackgroundTransparency = 1
    contClip.ClipsDescendants = true
    contClip.Visible = false

    lib.Tabs = {}
    lib.TabContainers = {}
    lib.ActiveTabIndex = 0
    lib.CurrentBuildContainer = defaultCont
    lib.UseTabs = false
    lib.ElementCounter =  0

    function lib:ChangePalette(name)
        if not cp[name] then return end
        curTheme = cp[name]
        
        local d = 0.5
        for _,v in pairs(objs.bg) do t(v, "BackgroundColor3", curTheme.bg, d) end
        for _,v in pairs(objs.fg) do t(v, "TextColor3", curTheme.fg, d) end
        for _,v in pairs(objs.pri) do t(v, "BackgroundColor3", curTheme.pri, d) end
        for _,v in pairs(objs.onpri) do t(v, "TextColor3", curTheme.onpri, d) end
        for _,v in pairs(objs.inact) do t(v, "BackgroundColor3", curTheme.inact, d) end
        for _,x in pairs(objs.s_trk) do t(x.obj, "BackgroundColor3", x.state and curTheme.pri or curTheme.inact, d) end
        for _,x in pairs(objs.s_thm) do t(x.obj, "BackgroundColor3", x.state and curTheme.onpri or curTheme.out, d) end
        for _,x in pairs(objs.tab_btn) do 
            t(x.lbl, "TextColor3", x.active and curTheme.pri or m3Gray, d)
            if x.icon then t(x.icon, "ImageColor3", x.active and curTheme.pri or m3Gray, d) end
        end
        for _, icn in pairs(objs.icon) do t(icn, "ImageColor3", curTheme.out, d) end
        for _, v in pairs(objs.sl_val) do t(v, "TextColor3", curTheme.pri, d) end

        for _,v in pairs(objs.dlg_bg) do t(v, "BackgroundColor3", curTheme.bg:Lerp(curTheme.pri, 0.11), d) end
        for _,v in pairs(objs.dlg_fg) do t(v, "TextColor3", curTheme.fg, d) end
        
        for _, tb in pairs(objs.tbox) do
            t(tb.lbl, "TextColor3", tb.focused and curTheme.pri or curTheme.out, d)
            t(tb.box, "TextColor3", curTheme.fg, d)
            t(tb.line, "BackgroundColor3", tb.focused and curTheme.pri or curTheme.out, d)
            t(tb.bg, "BackgroundColor3", curTheme.inact, d)
        end
    end

    function lib:SelectTab(txt)
        local targetIdx = 1
        for i, tData in ipairs(lib.Tabs) do
            if tData.btn.Text == txt then targetIdx = i break end
        end
        
        if targetIdx == lib.ActiveTabIndex then return end
        
        local dir = (targetIdx > lib.ActiveTabIndex) and 1 or -1
        if lib.ActiveTabIndex == 0 then dir = 0 end 
        
        local oldCont = (lib.ActiveTabIndex > 0) and lib.TabContainers[lib.ActiveTabIndex] or defaultCont
        local newCont = lib.TabContainers[targetIdx]

        for i, tData in ipairs(lib.Tabs) do
            local btn = tData.btn
            if i == targetIdx then
                tData.data.active = true
                t(tData.data.lbl, "TextColor3", curTheme.pri, 0.3)
                if tData.data.icon then t(tData.data.icon, "ImageColor3", curTheme.pri, 0.3) end
                            
                task.spawn(function()
                    rs.RenderStepped:Wait() 
                    rs.RenderStepped:Wait()
                    local btnCenterX = (btn.AbsolutePosition.X - tabListCont.AbsolutePosition.X) + tabListCont.CanvasPosition.X + (btn.AbsoluteSize.X / 2)
                    
                    local contentWidth = tData.data.lbl.TextBounds.X
                   
                    tw:Create(indicator, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
                         Position = UDim2.new(0, btnCenterX, 1, 0),
                         Size = UDim2.new(0, contentWidth, 0, 3)
                    }):Play()
                end)
            else
                tData.data.active = false
                t(tData.data.lbl, "TextColor3", m3Gray, 0.3)
                if tData.data.icon then t(tData.data.icon, "ImageColor3", m3Gray, 0.3) end
            end
        end

        if oldCont and dir ~= 0 and oldCont ~= defaultCont then
            newCont.Position = UDim2.new(dir, dir * 50, 0, 0)
            newCont.Visible = true
            t(oldCont, "Position", UDim2.new(-dir, -dir * 50, 0, 0), 0.4)
            t(newCont, "Position", UDim2.new(0, 0, 0, 0), 0.4)
            local savedOld = oldCont
            task.delay(0.4, function() 
                if lib.TabContainers[lib.ActiveTabIndex] ~= savedOld then savedOld.Visible = false end 
            end)
        else
            newCont.Position = UDim2.new(0, 0, 0, 0)
            newCont.Visible = true
            if oldCont and oldCont ~= defaultCont then oldCont.Visible = false end
        end
        
        lib.ActiveTabIndex = targetIdx
    end

    function lib:AddTab(txt, iconId)
        if not lib.UseTabs then
            lib.UseTabs = true
            tabArea.Visible = true
            contClip.Visible = true
            defaultCont.Visible = false
        end

        local btn = Instance.new("TextButton", tabListInner)
        btn.BackgroundTransparency = 1
        btn.FontFace = m3Font
        btn.Text = txt
        btn.TextSize = 14
        btn.TextTransparency = 1
        btn.TextColor3 = m3Gray
        btn.Size = UDim2.new(0, 20, 1, 0) 
        btn.AutomaticSize = Enum.AutomaticSize.X 

        local uip = Instance.new("UIPadding", btn)
        uip.PaddingLeft = UDim.new(0, 16)
        uip.PaddingRight = UDim.new(0, 16)

        local contentLayout = Instance.new("UIListLayout", btn)
        contentLayout.FillDirection = Enum.FillDirection.Horizontal
        contentLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
        contentLayout.VerticalAlignment = Enum.VerticalAlignment.Center
        contentLayout.SortOrder = Enum.SortOrder.LayoutOrder
        contentLayout.Padding = UDim.new(0, 8)

        local iconImg = nil
        if iconId and iconId ~= "" then
            iconImg = Instance.new("ImageLabel", btn)
            iconImg.BackgroundTransparency = 1
            iconImg.Image = iconId
            iconImg.Size = UDim2.new(0, 18, 0, 18)
            iconImg.ImageColor3 = m3Gray
            iconImg.LayoutOrder = 1
        end
        
        local txtLbl = Instance.new("TextLabel", btn)
        txtLbl.BackgroundTransparency = 1
        txtLbl.Text = txt
        txtLbl.FontFace = m3Font
        txtLbl.TextSize = 14
        txtLbl.TextColor3 = m3Gray
        txtLbl.AutomaticSize = Enum.AutomaticSize.XY
        txtLbl.LayoutOrder = 2
                
        local tData = {obj = btn, active = false, icon = iconImg, lbl = txtLbl}
        table.insert(objs.tab_btn, tData)
        
        local c = Instance.new("ScrollingFrame", contClip)
        c.Size = UDim2.new(1, 0, 1, 0)
        c.BackgroundTransparency = 1
        c.ScrollBarThickness = 0
        c.CanvasSize = UDim2.new(0, 0, 0, 0)
        c.AutomaticCanvasSize = Enum.AutomaticSize.Y
        c.Visible = false
        
        local cPad = Instance.new("UIPadding", c)
        cPad.PaddingLeft = UDim.new(0, 24)
        cPad.PaddingRight = UDim.new(0, 24)
        cPad.PaddingBottom = UDim.new(0, 20)
        cPad.PaddingTop = UDim.new(0, 20)

        local cLayout = Instance.new("UIListLayout", c)
        cLayout.SortOrder = Enum.SortOrder.LayoutOrder
        cLayout.Padding = UDim.new(0, 18)

        table.insert(lib.Tabs, {btn = btn, data = tData})
        table.insert(lib.TabContainers, c)
        
        lib.CurrentBuildContainer = c 

        btn.InputBegan:Connect(startTabDrag)

        btn.MouseButton1Click:Connect(function() 
            if not isDraggingTabAction then
                lib:SelectTab(txt) 
            end
        end)

        if #lib.Tabs == 1 then lib:SelectTab(txt) end
        
        return {
            SetText = function(self, newTxt)
                btn.Text = newTxt
                txtLbl.Text = newTxt
                if lib.ActiveTabIndex > 0 and lib.Tabs[lib.ActiveTabIndex].btn == btn then
                    lib:SelectTab(newTxt)
                end
            end
        }
    end

    function lib:AddDivider()
        lib.ElementCounter += 1
        local div = Instance.new("Frame", lib.CurrentBuildContainer)
        div.Size = UDim2.new(1, 0, 0, 1)
        div.LayoutOrder = lib.ElementCounter
        div.BackgroundColor3 = curTheme.inact
        div.BorderSizePixel = 0
        table.insert(objs.inact, div)
    end

    function lib:AddTextBox(labelTxt, cb)
        lib.ElementCounter += 1
        local frame = Instance.new("Frame", lib.CurrentBuildContainer)
        frame.LayoutOrder = lib.ElementCounter
        frame.Size = UDim2.new(1, 0, 0, 56)
        frame.BackgroundColor3 = curTheme.inact
        frame.BorderSizePixel = 0
        Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 4)
        table.insert(objs.inact, frame)
        
        local flatBot = Instance.new("Frame", frame)
        flatBot.Size = UDim2.new(1, 0, 0, 4)
        flatBot.Position = UDim2.new(0, 0, 1, -4)
        flatBot.BackgroundColor3 = curTheme.inact
        flatBot.BorderSizePixel = 0
        table.insert(objs.inact, flatBot)

        local lbl = Instance.new("TextLabel", frame)
        lbl.Size = UDim2.new(1, -32, 0, 20)
        lbl.Position = UDim2.new(0, 16, 0, 6)
        lbl.BackgroundTransparency = 1
        lbl.Text = labelTxt
        lbl.TextColor3 = curTheme.out
        lbl.FontFace = m3Font
        lbl.TextSize = 11
        lbl.TextXAlignment = Enum.TextXAlignment.Left

        local tbox = Instance.new("TextBox", frame)
        tbox.Size = UDim2.new(1, -32, 0, 24)
        tbox.Position = UDim2.new(0, 16, 0, 26)
        tbox.BackgroundTransparency = 1
        tbox.Text = ""
        tbox.PlaceholderText = ""
        tbox.TextColor3 = curTheme.fg
        tbox.FontFace = m3Font
        tbox.TextSize = 15
        tbox.TextXAlignment = Enum.TextXAlignment.Left
        tbox.ClearTextOnFocus = false

        local botLine = Instance.new("Frame", frame)
        botLine.Size = UDim2.new(1, 0, 0, 1)
        botLine.AnchorPoint = Vector2.new(0, 1)
        botLine.Position = UDim2.new(0, 0, 1, 0)
        botLine.BackgroundColor3 = curTheme.out
        botLine.BorderSizePixel = 0

        local tbData = {box = tbox, line = botLine, lbl = lbl, bg = frame, focused = false}
        table.insert(objs.tbox, tbData)

        tbox.Focused:Connect(function()
            tbData.focused = true
            t(botLine, "BackgroundColor3", curTheme.pri, 0.2)
            t(lbl, "TextColor3", curTheme.pri, 0.2)
            tw:Create(botLine, TweenInfo.new(0.2, Enum.EasingStyle.Exponential), {Size = UDim2.new(1, 0, 0, 2)}):Play()
        end)

        tbox.FocusLost:Connect(function(enter)
            tbData.focused = false
            t(botLine, "BackgroundColor3", curTheme.out, 0.2)
            t(lbl, "TextColor3", curTheme.out, 0.2)
            tw:Create(botLine, TweenInfo.new(0.2, Enum.EasingStyle.Exponential), {Size = UDim2.new(1, 0, 0, 1)}):Play()
            if cb then cb(tbox.Text, enter) end
        end)

        return {
            SetText = function(self, newTxt)
                lbl.Text = newTxt
            end,
            SetValue = function(self, newVal)
                tbox.Text = tostring(newVal)
            end
        }
    end

function lib:AddButton(txt, cb, wdth)
        lib.ElementCounter += 1

        local container = Instance.new("Frame", lib.CurrentBuildContainer)
        container.LayoutOrder = lib.ElementCounter
        container.Size = UDim2.new(1, 0, 0, 44)
        container.BackgroundTransparency = 1

        local b = Instance.new("TextButton", container)

        if wdth  then
            b.Size = UDim2.new(0, wdth, 1, 0)
            b.AnchorPoint = Vector2.new(0.5, 0.5)
            b.Position = UDim2.new(0.5, 0, 0.5, 0)
        else
            b.Size = UDim2.new(1, 0, 1, 0)
            b.Position = UDim2.new(0, 0, 0, 0)
        end
        
        b.BackgroundColor3 = curTheme.pri
        b.Text = ""
        b.AutoButtonColor = false
        table.insert(objs.pri, b)
        Instance.new("UICorner", b).CornerRadius = UDim.new(1, 0)

        local txl = Instance.new("TextLabel", b)
        txl.Size = UDim2.new(1, 0, 1, 0)
        txl.BackgroundTransparency = 1
        txl.Text = txt
        txl.TextColor3 = curTheme.onpri
        txl.FontFace = m3Font
        txl.TextSize = 15
        table.insert(objs.onpri, txl)

        b.MouseEnter:Connect(function() t(b, "BackgroundColor3", curTheme.fg, 0.2) end)
        b.MouseLeave:Connect(function() t(b, "BackgroundColor3", curTheme.pri, 0.2) end)
        b.MouseButton1Click:Connect(function() 
            if cb then cb() end 
        end)
        
        return {
            SetText = function(self, newTxt)
                txl.Text = newTxt
            end
        }
    end

    function lib:AddSwitch(txt, def, cb)
        lib.ElementCounter += 1
        local st = def or false
        local r = Instance.new("Frame", lib.CurrentBuildContainer)
        r.LayoutOrder = lib.ElementCounter
        r.Size = UDim2.new(1, 0, 0, 48)
        r.BackgroundTransparency = 1

        local l = Instance.new("TextLabel", r)
        l.Size = UDim2.new(1, -60, 1, 0)
        l.BackgroundTransparency = 1
        l.Text = txt
        l.TextColor3 = curTheme.fg
        l.FontFace = m3Font
        l.TextSize = 16
        l.TextXAlignment = Enum.TextXAlignment.Left
        table.insert(objs.fg, l)

        local trk = Instance.new("TextButton", r)
        trk.Size = UDim2.new(0, 52, 0, 32)
        trk.AnchorPoint = Vector2.new(1, 0.5)
        trk.Position = UDim2.new(1, 0, 0.5, 0)
        trk.BackgroundColor3 = st and curTheme.pri or curTheme.inact
        trk.Text = ""
        trk.AutoButtonColor = false
        Instance.new("UICorner", trk).CornerRadius = UDim.new(1, 0)
        local tData = {obj=trk, state=st}
        table.insert(objs.s_trk, tData)

        local thm = Instance.new("Frame", trk)
        thm.AnchorPoint = Vector2.new(0.5, 0.5)
        thm.Size = st and UDim2.new(0, 24, 0, 24) or UDim2.new(0, 16, 0, 16)
        thm.Position = st and UDim2.new(0, 36, 0.5, 0) or UDim2.new(0, 16, 0.5, 0)
        thm.BackgroundColor3 = st and curTheme.onpri or curTheme.out
        Instance.new("UICorner", thm).CornerRadius = UDim.new(1, 0)
        local thData = {obj=thm, state=st}
        table.insert(objs.s_thm, thData)

        trk.MouseButton1Click:Connect(function()
            st = not st
            tData.state = st; thData.state = st
            t(trk, "BackgroundColor3", st and curTheme.pri or curTheme.inact, 0.3)
            tw:Create(thm, TweenInfo.new(0.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
                Size = st and UDim2.new(0, 24, 0, 24) or UDim2.new(0, 16, 0, 16),
                Position = st and UDim2.new(0, 36, 0.5, 0) or UDim2.new(0, 16, 0.5, 0),
                BackgroundColor3 = st and curTheme.onpri or curTheme.out
            }):Play()
            if cb then cb(st) end
        end)

        return {
            SetText = function(self, newTxt)
                l.Text = newTxt
            end,
            SetValue = function(self, newState)
                if st == newState then return end
                st = newState
                tData.state = st; thData.state = st
                t(trk, "BackgroundColor3", st and curTheme.pri or curTheme.inact, 0.3)
                tw:Create(thm, TweenInfo.new(0.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
                    Size = st and UDim2.new(0, 24, 0, 24) or UDim2.new(0, 16, 0, 16),
                    Position = st and UDim2.new(0, 36, 0.5, 0) or UDim2.new(0, 16, 0.5, 0),
                    BackgroundColor3 = st and curTheme.onpri or curTheme.out
                }):Play()
                if cb then cb(st) end
            end
        }
    end

    function lib:AddSlider(txt, m, mx, df, lblval, cb)
        lib.ElementCounter += 1
        local v = math.clamp(df or m, m, mx)
        local drag = false

        local r = Instance.new("Frame", lib.CurrentBuildContainer)
        r.LayoutOrder = lib.ElementCounter
        r.Size = UDim2.new(1, 0, 0, 75)
        r.BackgroundTransparency = 1

        local vl = Instance.new("TextLabel", r)
        vl.Size = UDim2.new(1, -50, 0, 20) 
        vl.BackgroundTransparency = 1
        vl.Text = txt
        vl.TextColor3 = curTheme.fg
        vl.FontFace = m3Font
        vl.TextSize = 14
        vl.TextXAlignment = Enum.TextXAlignment.Left
        table.insert(objs.fg, vl)

        local valLbl = Instance.new("TextLabel", r)
        valLbl.Size = UDim2.new(0, 50, 0, 20)
        valLbl.AnchorPoint = Vector2.new(1, 0)
        valLbl.Position = UDim2.new(1, 0, 0, 0)
        valLbl.BackgroundTransparency = 1
        valLbl.Visible = lblval
        valLbl.Text = string.format("%.2f", v)
        valLbl.TextColor3 = curTheme.pri
        valLbl.FontFace = m3Font
        valLbl.TextSize = 14
        valLbl.TextXAlignment = Enum.TextXAlignment.Right
        table.insert(objs.sl_val, valLbl)

        local hb = Instance.new("TextButton", r)
        hb.Size = UDim2.new(1, 0, 0, 40)
        hb.Position = UDim2.new(0, 0, 0, 25)
        hb.BackgroundTransparency = 1
        hb.Text = ""

        local act = Instance.new("CanvasGroup", hb)
        act.AnchorPoint = Vector2.new(0, 0.5)
        act.Position = UDim2.new(0, 0, 0.5, 0)
        act.BackgroundColor3 = curTheme.pri
        act.BorderSizePixel = 0
        local actuic = Instance.new("UICorner", act)
        actuic.CornerRadius = UDim.new(1, 0)
        actuic.TopRightRadius = UDim.new(0, 4)
        actuic.BottomRightRadius = UDim.new(0, 4)
        table.insert(objs.pri, act)

        local inact = Instance.new("CanvasGroup", hb)
        inact.AnchorPoint = Vector2.new(1, 0.5)
        inact.Position = UDim2.new(1, 0, 0.5, 0)
        inact.BackgroundColor3 = curTheme.inact
        inact.BorderSizePixel = 0
        local inactuic = Instance.new("UICorner", inact)
        inactuic.CornerRadius = UDim.new(1, 0)
        inactuic.TopLeftRadius = UDim.new(0, 4)
        inactuic.BottomLeftRadius = UDim.new(0, 4)
        table.insert(objs.inact, inact)

        local dot = Instance.new("Frame", inact)
        dot.Size = UDim2.new(0, 4, 0, 4)
        dot.AnchorPoint = Vector2.new(1, 0.5)
        dot.Position = UDim2.new(1, -6, 0.5, 0)
        dot.BackgroundColor3 = curTheme.pri
        Instance.new("UICorner", dot).CornerRadius = UDim.new(1, 0)
        table.insert(objs.pri, dot)

        local thm = Instance.new("Frame", hb)
        thm.Size = UDim2.new(0, 4, 0, 38)
        thm.AnchorPoint = Vector2.new(0.5, 0.5)
        thm.BackgroundColor3 = curTheme.pri
        Instance.new("UICorner", thm).CornerRadius = UDim.new(0, 2)
        table.insert(objs.pri, thm)

        local g = 6
        local function upd(inp)
            local pc = math.clamp((inp.Position.X - hb.AbsolutePosition.X) / hb.AbsoluteSize.X, 0, 1)
            v = m + ((mx - m) * pc)
            valLbl.Text = string.format("%.2f", v)
            local tx = hb.AbsoluteSize.X * pc
            act.Size = UDim2.new(0, math.max(0, tx - g), 0, 16)
            inact.Size = UDim2.new(0, math.max(0, hb.AbsoluteSize.X - tx - g), 0, 16)
            thm.Position = UDim2.new(0, tx, 0.5, 0)
            if cb then cb(v) end
        end

        task.defer(function()
            local p = (v - m) / (mx - m)
            local tX = hb.AbsoluteSize.X * p
            act.Size = UDim2.new(0, math.max(0, tX-g), 0, 16)
            inact.Size = UDim2.new(0, math.max(0, hb.AbsoluteSize.X-tX-g), 0, 16)
            thm.Position = UDim2.new(0, tX, 0.5, 0)
        end)

        hb:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
            local p = (v - m) / (mx - m)
            local tX = hb.AbsoluteSize.X * p
            act.Size = UDim2.new(0, math.max(0, tX-g), 0, 16)
            inact.Size = UDim2.new(0, math.max(0, hb.AbsoluteSize.X-tX-g), 0, 16)
            thm.Position = UDim2.new(0, tX, 0.5, 0)
        end)

        hb.InputBegan:Connect(function(i) 
            if i.UserInputType.Name:find("MouseButton1") or i.UserInputType.Name:find("Touch") then 
                drag = true; upd(i) 
            end 
        end)
        uis.InputChanged:Connect(function(i) 
            if drag and (i.UserInputType.Name:find("MouseMovement") or i.UserInputType.Name:find("Touch")) then 
                upd(i) 
            end 
        end)
        uis.InputEnded:Connect(function(i) 
            if i.UserInputType.Name:find("MouseButton1") or i.UserInputType.Name:find("Touch") then 
                drag = false 
            end 
        end)

        return {
            SetText = function(self, newTxt)
                vl.Text = newTxt
            end,
            SetValue = function(self, newVal)
                v = math.clamp(newVal, m, mx)
                valLbl.Text = string.format("%.2f", v)
                
                local p = (v - m) / (mx - m)
                local tX = hb.AbsoluteSize.X * p
                act.Size = UDim2.new(0, math.max(0, tX - g), 0, 16)
                inact.Size = UDim2.new(0, math.max(0, hb.AbsoluteSize.X - tX - g), 0, 16)
                thm.Position = UDim2.new(0, tX, 0.5, 0)
                
                if cb then cb(v) end
            end
        }
    end

function lib:AddDropdown(txt, options, defaultIdx, cb)
        lib.ElementCounter += 1
        local selectedIdx = defaultIdx or 1
        local isOpen = false
    
        local r = Instance.new("Frame", lib.CurrentBuildContainer)
        r.LayoutOrder = lib.ElementCounter
        r.Size = UDim2.new(1, 0, 0, 56)
        r.BackgroundColor3 = curTheme.inact
        r.BorderSizePixel = 0
        Instance.new("UICorner", r).CornerRadius = UDim.new(0, 4)
        table.insert(objs.inact, r)
    
        local lbl = Instance.new("TextLabel", r)
        lbl.Size = UDim2.new(1, -32, 0, 20)
        lbl.Position = UDim2.new(0, 16, 0, 6)
        lbl.BackgroundTransparency = 1
        lbl.Text = txt
        lbl.TextColor3 = curTheme.out
        lbl.FontFace = m3Font
        lbl.TextSize = 11
        lbl.TextXAlignment = Enum.TextXAlignment.Left
    
        local valLbl = Instance.new("TextLabel", r)
        valLbl.Size = UDim2.new(1, -48, 0, 24)
        valLbl.Position = UDim2.new(0, 16, 0, 26)
        valLbl.BackgroundTransparency = 1
        valLbl.Text = options[selectedIdx] or ""
        valLbl.TextColor3 = curTheme.fg
        valLbl.FontFace = m3Font
        valLbl.TextSize = 15
        valLbl.TextXAlignment = Enum.TextXAlignment.Left
        table.insert(objs.fg, valLbl)
    
        local icn = Instance.new("ImageLabel", r)
        icn.Size = UDim2.new(0, 24, 0, 24)
        icn.AnchorPoint = Vector2.new(1, 0.5)
        icn.Position = UDim2.new(1, -12, 0.5, 0)
        icn.BackgroundTransparency = 1
        icn.Image = "rbxassetid://10709790948"
        icn.ImageColor3 = curTheme.out
        table.insert(objs.icon, icn)
    
        local btn = Instance.new("TextButton", r)
        btn.Size = UDim2.new(1, 0, 1, 0)
        btn.BackgroundTransparency = 1
        btn.Text = ""
    
        local botLine = Instance.new("Frame", r)
        botLine.Size = UDim2.new(1, 0, 0, 1)
        botLine.AnchorPoint = Vector2.new(0, 1)
        botLine.Position = UDim2.new(0, 0, 1, 0)
        botLine.BackgroundColor3 = curTheme.out
        botLine.BorderSizePixel = 0
    
        local menuObj = nil
        local trackConn = nil
        local closeOverlay = nil
        
        local function closeMenu()
            if not isOpen then return end
            isOpen = false
            tw:Create(icn, TweenInfo.new(0.3, Enum.EasingStyle.Exponential), {Rotation = 0}):Play()
            t(botLine, "BackgroundColor3", curTheme.out, 0.3)
            t(lbl, "TextColor3", curTheme.out, 0.3)
            
            if trackConn then trackConn:Disconnect() end
            
            if closeOverlay then
                closeOverlay:Destroy()
                closeOverlay = nil
            end
            
            if menuObj then
                t(menuObj, "BackgroundTransparency", 1, 0.2)
                for _, child in pairs(menuObj:GetChildren()) do
                    if child:IsA("TextButton") then
                        t(child, "TextTransparency", 1, 0.2)
                    end
                end
                task.delay(0.2, function()
                    if menuObj then menuObj:Destroy() menuObj = nil end
                end)
            end
        end
    
        btn.MouseButton1Click:Connect(function()
            if isOpen then
                closeMenu()
            else
                isOpen = true
                tw:Create(icn, TweenInfo.new(0.3, Enum.EasingStyle.Exponential), {Rotation = 180}):Play()
                t(botLine, "BackgroundColor3", curTheme.pri, 0.3)
                t(lbl, "TextColor3", curTheme.pri, 0.3)
                
                closeOverlay = Instance.new("TextButton", gui)
                closeOverlay.Size = UDim2.new(1, 0, 1, 0)
                closeOverlay.BackgroundTransparency = 1
                closeOverlay.Text = ""
                closeOverlay.ZIndex = 499
                closeOverlay.MouseButton1Click:Connect(closeMenu)

                menuObj = Instance.new("ScrollingFrame", gui)
                menuObj.Size = UDim2.new(0, r.AbsoluteSize.X, 0, math.min(#options * 48, 144))
                menuObj.Position = UDim2.new(0, r.AbsolutePosition.X, 0, r.AbsolutePosition.Y + r.AbsoluteSize.Y + 4)
                menuObj.BackgroundColor3 = curTheme.bg:Lerp(curTheme.pri, 0.08)
                menuObj.BorderSizePixel = 0
                menuObj.ZIndex = 500
                menuObj.ScrollBarThickness = 2
                menuObj.ScrollBarImageColor3 = curTheme.out
                menuObj.BackgroundTransparency = 1
                menuObj.ClipsDescendants = true
                menuObj.AutomaticCanvasSize = Enum.AutomaticSize.Y
                menuObj.CanvasSize = UDim2.new(0, 0, 0, 0)
                Instance.new("UICorner", menuObj).CornerRadius = UDim.new(0, 4) 
                table.insert(objs.dlg_bg, menuObj) 

                trackConn = rs.RenderStepped:Connect(function()
                    if not isOpen or not menuObj then trackConn:Disconnect() return end
                    menuObj.Position = UDim2.new(0, r.AbsolutePosition.X, 0, r.AbsolutePosition.Y + r.AbsoluteSize.Y + 4)
                end)
    
                local mLayout = Instance.new("UIListLayout", menuObj)
                mLayout.SortOrder = Enum.SortOrder.LayoutOrder
    
                for i, opt in ipairs(options) do
                    local optBtn = Instance.new("TextButton", menuObj)
                    optBtn.Size = UDim2.new(1, 0, 0, 48)
                    optBtn.BackgroundTransparency = 1
                    optBtn.Text = opt
                    optBtn.FontFace = m3Font
                    optBtn.TextSize = 14
                    optBtn.TextColor3 = curTheme.fg
                    optBtn.TextXAlignment = Enum.TextXAlignment.Left
                    optBtn.LayoutOrder = i
                    optBtn.ZIndex = 501
                    optBtn.TextTransparency = 1
                    table.insert(objs.dlg_fg, optBtn)
                    
                    local p = Instance.new("UIPadding", optBtn)
                    p.PaddingLeft = UDim.new(0, 16)
                    p.PaddingRight = UDim.new(0, 16)
    
                    optBtn.MouseEnter:Connect(function() t(optBtn, "BackgroundTransparency", 0.9, 0.1) end)
                    optBtn.MouseLeave:Connect(function() t(optBtn, "BackgroundTransparency", 1, 0.1) end)
    
                    optBtn.MouseButton1Click:Connect(function()
                        selectedIdx = i
                        valLbl.Text = opt
                        if cb then cb(opt) end
                        closeMenu()
                    end)
                end
    
                tw:Create(menuObj, TweenInfo.new(0.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play()
                for _, child in pairs(menuObj:GetChildren()) do
                    if child:IsA("TextButton") then
                        t(child, "TextTransparency", 0, 0.3)
                    end
                end
            end
        end)

        return {
            SetText = function(self, newTxt)
                lbl.Text = newTxt
            end,

            SetValue = function(self, newOpt)
                valLbl.Text = newOpt
                if cb then cb(newOpt) end
            end,

            Refresh = function(self, newOptions, newDefaultIdx)
                currentOptions = newOptions or {}
                selectedIdx = newDefaultIdx or 1
                valLbl.Text = currentOptions[selectedIdx] or ""
                if isOpen then closeMenu() end
            end
        }
    end

    function lib:AddDialog(title, desc, confirmText, cancelText, confirmCb, cancelCb)
         local overlay = Instance.new("Frame", gui)
         overlay.Size = UDim2.new(1, 0, 1, 0)
         overlay.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
         overlay.BackgroundTransparency = 1
         overlay.Active = true
         overlay.Visible = true
         
         local dlgBox = Instance.new("Frame", overlay)
         dlgBox.Size = UDim2.new(0, 312, 0, 0) 
         dlgBox.AnchorPoint = Vector2.new(0.5, 0.5)
         dlgBox.Position = UDim2.new(0.5, 0, 0.5, 20)
         dlgBox.BackgroundColor3 = curTheme.bg:Lerp(curTheme.pri, 0.11)
         dlgBox.AutomaticSize = Enum.AutomaticSize.Y
         dlgBox.BackgroundTransparency = 1
         table.insert(objs.dlg_bg, dlgBox)
         
         Instance.new("UICorner", dlgBox).CornerRadius = UDim.new(0, 28)
         
         local dPad = Instance.new("UIPadding", dlgBox)
         dPad.PaddingLeft = UDim.new(0, 24)
         dPad.PaddingRight = UDim.new(0, 24)
         dPad.PaddingTop = UDim.new(0, 24)
         dPad.PaddingBottom = UDim.new(0, 24)
         
         local dLayout = Instance.new("UIListLayout", dlgBox)
         dLayout.SortOrder = Enum.SortOrder.LayoutOrder
         dLayout.Padding = UDim.new(0, 16)
         
         local dTitle = Instance.new("TextLabel", dlgBox)
         dTitle.Size = UDim2.new(1, 0, 0, 0)
         dTitle.AutomaticSize = Enum.AutomaticSize.Y
         dTitle.BackgroundTransparency = 1
         dTitle.Text = title or "Dialog Title"
         dTitle.TextColor3 = curTheme.fg
         dTitle.FontFace = Font.new(m3Font.Family, Enum.FontWeight.Medium, Enum.FontStyle.Normal)
         dTitle.TextSize = 24 
         dTitle.TextXAlignment = Enum.TextXAlignment.Left
         dTitle.TextWrapped = true
         dTitle.TextTransparency = 1
         dTitle.LayoutOrder = 1
         table.insert(objs.dlg_fg, dTitle)
         
         local dDesc = Instance.new("TextLabel", dlgBox)
         dDesc.Size = UDim2.new(1, 0, 0, 0)
         dDesc.AutomaticSize = Enum.AutomaticSize.Y
         dDesc.BackgroundTransparency = 1
         dDesc.Text = desc or "Dialog description text goes here."
         dDesc.TextColor3 = curTheme.out
         dDesc.FontFace = m3Font
         dDesc.TextSize = 14 
         dDesc.TextXAlignment = Enum.TextXAlignment.Left
         dDesc.TextWrapped = true
         dDesc.TextTransparency = 1
         dDesc.LayoutOrder = 2
         
         local actCont = Instance.new("Frame", dlgBox)
         actCont.Size = UDim2.new(1, 0, 0, 40)
         actCont.BackgroundTransparency = 1
         actCont.LayoutOrder = 3
         
         local actLayout = Instance.new("UIListLayout", actCont)
         actLayout.FillDirection = Enum.FillDirection.Horizontal
         actLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
         actLayout.VerticalAlignment = Enum.VerticalAlignment.Center
         actLayout.SortOrder = Enum.SortOrder.LayoutOrder
         actLayout.Padding = UDim.new(0, 8)
 
         local function closeDialog()
             t(overlay, "BackgroundTransparency", 1, 0.3)
             tw:Create(dlgBox, TweenInfo.new(0.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
                 Position = UDim2.new(0.5, 0, 0.5, 20),
                 BackgroundTransparency = 1
             }):Play()
             
             t(dTitle, "TextTransparency", 1, 0.2)
             t(dDesc, "TextTransparency", 1, 0.2)
             for _, b in pairs(actCont:GetChildren()) do
                 if b:IsA("TextButton") then t(b, "TextTransparency", 1, 0.2) end
             end
             
             task.delay(0.3, function() 
                 overlay:Destroy()
             end)
         end
         
         local function makeTextBtn(txt, isPrimary, cb)
             local btn = Instance.new("TextButton", actCont)
             btn.BackgroundTransparency = 1
             btn.Text = txt
             btn.FontFace = Font.new(m3Font.Family, Enum.FontWeight.Medium, Enum.FontStyle.Normal)
             btn.TextSize = 14
             btn.TextColor3 = curTheme.pri
             btn.Size = UDim2.new(0, 0, 0, 40)
             btn.AutomaticSize = Enum.AutomaticSize.X
             btn.TextTransparency = 1
             table.insert(objs.pri, btn)
             Instance.new("UICorner", btn).CornerRadius = UDim.new(1, 0)
             
             local padding = Instance.new("UIPadding", btn)
             padding.PaddingLeft = UDim.new(0, 12)
             padding.PaddingRight = UDim.new(0, 12)
             
             btn.MouseEnter:Connect(function()
                 t(btn, "BackgroundTransparency", 0.92, 0.2)
                 t(btn, "BackgroundColor3", curTheme.pri, 0.2)
             end)
             btn.MouseLeave:Connect(function()
                 t(btn, "BackgroundTransparency", 1, 0.2)
             end)
             
             btn.MouseButton1Click:Connect(function()
                 closeDialog()
                 if cb then cb() end
             end)
         end
         
         if cancelText then makeTextBtn(cancelText, false, cancelCb) end
         makeTextBtn(confirmText or "OK", true, confirmCb)
         
         t(overlay, "BackgroundTransparency", 0.6, 0.4)
         tw:Create(dlgBox, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
             Position = UDim2.new(0.5, 0, 0.5, 0),
             BackgroundTransparency = 0
         }):Play()
         
         t(dTitle, "TextTransparency", 0, 0.4)
         t(dDesc, "TextTransparency", 0, 0.4)
         for _, b in pairs(actCont:GetChildren()) do
             if b:IsA("TextButton") then t(b, "TextTransparency", 0, 0.4) end
         end
     end

    resizeHandle = Instance.new("TextButton", win)
    resizeHandle.Size = UDim2.new(0, 30, 0, 30)
    resizeHandle.AnchorPoint = Vector2.new(1, 1)
    resizeHandle.Position = UDim2.new(1, 0, 1, 0)
    resizeHandle.BackgroundTransparency = 1
    resizeHandle.Text = ""
    resizeHandle.ZIndex = 100

    local resizing = false
    local resDragStart, resStartSize

    resizeHandle.InputBegan:Connect(function(i)
        if isMin or isMax then return end 
        if i.UserInputType.Name:find("MouseButton1") or i.UserInputType.Name:find("Touch") then
            resizing = true
            resDragStart = i.Position
            resStartSize = win.AbsoluteSize
        end
    end)

    uis.InputChanged:Connect(function(i)
        if resizing and (i.UserInputType.Name:find("MouseMovement") or i.UserInputType.Name:find("Touch")) then
            local delta = i.Position - resDragStart
            local newX = math.max(320, resStartSize.X + delta.X)
            local newY = math.max(400, resStartSize.Y + delta.Y)
            win.Size = UDim2.new(0, newX, 0, newY)
        end
    end)

    uis.InputEnded:Connect(function(i)
        if i.UserInputType.Name:find("MouseButton1") or i.UserInputType.Name:find("Touch") then
            resizing = false
        end
    end)

    win:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
        if lib.ActiveTabIndex > 0 and lib.Tabs[lib.ActiveTabIndex] then
            task.spawn(function()
                rs.RenderStepped:Wait() 
                rs.RenderStepped:Wait()
                local btn = lib.Tabs[lib.ActiveTabIndex].btn
                local btnCenterX = (btn.AbsolutePosition.X - tabListCont.AbsolutePosition.X) + tabListCont.CanvasPosition.X + (btn.AbsoluteSize.X / 2)
                local contentWidth = lib.Tabs[lib.ActiveTabIndex].data.lbl.TextBounds.X
                indicator.Position = UDim2.new(0, btnCenterX, 1, 0)
                indicator.Size = UDim2.new(0, contentWidth, 0, 3)
            end)
        end
    end)

    local d, di, ds, sp
    win.InputBegan:Connect(function(i) 
        if i.UserInputType.Name:find("MouseButton1") or i.UserInputType.Name:find("Touch") then 
            if isMax then return end 
            d = true; ds = i.Position; sp = win.Position 
        end 
    end)
    
    win.InputEnded:Connect(function(i) 
        if i.UserInputType.Name:find("MouseButton1") or i.UserInputType.Name:find("Touch") then 
            d = false 
        end 
    end)
    
    uis.InputChanged:Connect(function(i) 
        if i.UserInputType.Name:find("MouseMovement") or i.UserInputType.Name:find("Touch") then 
            di = i 
        end 
    end)
    
    rs.RenderStepped:Connect(function() 
        if d and di and not resizing then 
            win.Position = UDim2.new(sp.X.Scale, sp.X.Offset + (di.Position - ds).X, sp.Y.Scale, sp.Y.Offset + (di.Position - ds).Y) 
        end 
    end)

    return setmetatable(lib, {
        __index = {
            SetTitle = function(self, newTitle)
                top.Text = newTitle
            end
        }
    })
end

local ui = CreateM3UI("Material 3 Ultimate Hub", 450, 600)

ui:AddTab("Combat", "rbxassetid://111317703462067")

local aimbotSwitch = ui:AddSwitch("Enable Aimbot", false, function(state)
    print("[Combat] Aimbot toggled:", state)
end)

local targetPartDrop = ui:AddDropdown("Target Part", {"Head", "UpperTorso", "LowerTorso", "HumanoidRootPart"}, 1, function(selected)
    print("[Combat] Locked target to:", selected)
end)

ui:AddDivider()

local fovSlider = ui:AddSlider("FOV Circle Radius", 10, 500, 150, true, function(value)
    print("[Combat] FOV changed to:", value)
end)

local targetBox = ui:AddTextBox("Specific Target Name", function(text, enterPressed)
    if enterPressed then
        print("[Combat] Targeting player:", text)
    end
end)

ui:AddDivider()

local updateBtn = ui:AddButton("Force Update All Values", function()
    ui:AddDialog(
        "Override Settings?",
        "This will dynamically change all text and values of the UI components via script.",
        "Override",
        "Cancel",
        function() 
            print("[Dialog] Override confirmed by user!")

            aimbotSwitch:SetText("Aimbot (Forced On)")
            aimbotSwitch:SetValue(true)
            
            targetPartDrop:SetText("Part (Locked)")
            targetPartDrop:SetValue("HumanoidRootPart")
            
            fovSlider:SetText("FOV (Maxed Out)")
            fovSlider:SetValue(500)
            
            targetBox:SetText("Target (Auto)")
            targetBox:SetValue("RobloxPlayer123")
        end,
        function() 
            print("[Dialog] Override cancelled by user.") 
        end
    )
end, 402)

ui:AddTab("Visuals", "rbxassetid://111317703462067")

ui:AddSwitch("Enable Player ESP", true, function(state)
    print("[Visuals] ESP Status:", state)
end)

ui:AddDropdown("ESP Highlight Type", {"Box", "Skeleton", "Chams", "Glow"}, 1, function(selected)
    print("[Visuals] ESP Type:", selected)
end)

ui:AddDivider()

ui:AddSlider("ESP Transparency", 0, 1, 0.5, true, function(value)
    print("[Visuals] Transparency:", value)
end)

ui:AddSlider("Max Render Distance", 100, 5000, 1000, true, function(value)
    print("[Visuals] Render Distance:", value)
end)

ui:AddTab("Themes")

ui:AddButton("Apply Ocean Blue", function() 
    ui:ChangePalette("Blue") 
    print("[Theme] Changed to Ocean Blue")
end)

ui:AddButton("Apply Emerald Green", function() 
    ui:ChangePalette("Green") 
    print("[Theme] Changed to Emerald Green")
end)

ui:AddButton("Apply Sunset Orange", function() 
    ui:ChangePalette("Orange") 
    print("[Theme] Changed to Sunset Orange")
end)

ui:AddButton("Apply Dark Purple", function() 
    ui:ChangePalette("Purple") 
    print("[Theme] Changed to Dark Purple")
end)

ui:AddButton("Apply Crimson Red", function() 
    ui:ChangePalette("Red") 
    print("[Theme] Changed to Crimson Red")
end)

ui:AddButton("Apply Pitch Black", function() 
    ui:ChangePalette("PitchBlack") 
    print("[Theme] Changed to Pitch Black")
end)

for i = 4, 12 do
    ui:AddTab("Misc " .. i)
    
    ui:AddButton("Button in Misc " .. i, function() 
        print("Clicked dummy button in Tab " .. i) 
    end)
    
    ui:AddTextBox("Input " .. i, function(text, enter)
        if enter then print("Input saved in Tab " .. i .. ":", text) end
    end)
end

Features & Information

Deprecated. Use the new one: • https://fiangg20.github.io/nox/ • https://scriptblox.com/script/Universal-Script-Baselined-Example-UI-Library-223058 Nox - Elevate Your Roblox UI Development Tired of clunky, rigid, and uninspiring user interfaces ruining the experience of your Roblox projects? That is precisely why Nox was created. Nox is a Material You and Material 3 inspired custom UI library tailored specifically for Roblox scripters and developers. Its core philosophy is simple: to provide a framework that delivers incredibly smooth transitions, dynamic theming, and exceptional developer flexibility, all without sacrificing ease of use. Key Features and Capabilities: Fluid, Premium Animations: Utilizing exponential easing styles and CanvasGroup elements, interacting with menus, switching tabs, and expanding dropdowns feels exactly like using a high-end modern application. Dynamic Palette Theming: Seamlessly switch between multiple meticulously designed presets—such as Ocean Blue, Emerald Green, or Pitch Black—with a single function call, instantly restyling the entire interface. Component Versatility: Build highly adaptable components, including auto-scrolling dropdowns for extensive lists, clean modal dialog overlays, and center-aligned buttons with adjustable width scaling. Nox handles the complexities of your visual hierarchy, allowing you to focus entirely on your core game scripting logic. Build sleek, professional utility panels and hubs efficiently. Note: This is a demo for Nox. We will release the full API as fast as possible.
#google#ui library#material you#open source

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts