--!strict -- File: UI/CodeCopilotUI.lua (ModuleScript) -- Usage: -- local UI = require(path.to.module) -- local win = UI:CreateWindow({Title="My Hub", Subtitle="v1.0", Keybind=Enum.KeyCode.RightShift}) -- local tab = win:Tab("Main") -- local sec = tab:Section("Combat") -- sec:Toggle({Name="Silent Aim", Default=false, Callback=function(v) print(v) end}) local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local RunService = game:GetService("RunService") local HttpService = game:GetService("HttpService") local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") type Callback = (T) -> () type Theme = { Background: Color3, Panel: Color3, Panel2: Color3, Stroke: Color3, StrokeSoft: Color3, Text: Color3, TextDim: Color3, Accent: Color3, Accent2: Color3, Good: Color3, Bad: Color3 } type LibraryT = { Theme: Theme, Flags: {[string]: any}, Instances: {ScreenGui: ScreenGui?}, Connections: {RBXScriptConnection}, Toasts: {Frame}, Visible: boolean, Dragging: boolean, DragOffset: Vector2, SearchQuery: string, CreateWindow: (self: LibraryT, opts: {[string]: any}) -> any, Notify: (self: LibraryT, title: string, text: string, duration: number?) -> (), SaveConfig: (self: LibraryT, name: string) -> boolean, LoadConfig: (self: LibraryT, name: string) -> boolean, Destroy: (self: LibraryT) -> () } local Library: LibraryT = {} :: any Library.Flags = {} Library.Instances = {ScreenGui = nil} Library.Connections = {} Library.Toasts = {} Library.Visible = true Library.Dragging = false Library.DragOffset = Vector2.new() Library.SearchQuery = "" Library.Theme = { Background = Color3.fromRGB(12, 12, 16), Panel = Color3.fromRGB(18, 18, 24), Panel2 = Color3.fromRGB(24, 24, 33), Stroke = Color3.fromRGB(60, 60, 80), StrokeSoft = Color3.fromRGB(40, 40, 55), Text = Color3.fromRGB(235, 235, 245), TextDim = Color3.fromRGB(170, 170, 185), Accent = Color3.fromRGB(122, 92, 255), Accent2 = Color3.fromRGB(72, 210, 255), Good = Color3.fromRGB(60, 220, 120), Bad = Color3.fromRGB(255, 90, 110), } local function isFileEnv(): boolean return (typeof(writefile) == "function") and (typeof(readfile) == "function") and (typeof(isfile) == "function") end local function deepCopy(t: any): any if typeof(t) ~= "table" then return t end local out = {} for k, v in pairs(t) do out[k] = deepCopy(v) end return out end local function tween(inst: Instance, info: TweenInfo, props: {[string]: any}) local tw = TweenService:Create(inst, info, props) tw:Play() return tw end local function uiCorner(parent: Instance, r: number) local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, r) c.Parent = parent return c end local function uiStroke(parent: Instance, thickness: number, color: Color3, transparency: number?) local s = Instance.new("UIStroke") s.Thickness = thickness s.Color = color s.Transparency = transparency or 0 s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border s.Parent = parent return s end local function uiPadding(parent: Instance, l: number, r: number, t: number, b: number) local p = Instance.new("UIPadding") p.PaddingLeft = UDim.new(0, l) p.PaddingRight = UDim.new(0, r) p.PaddingTop = UDim.new(0, t) p.PaddingBottom = UDim.new(0, b) p.Parent = parent return p end local function uiList(parent: Instance, padding: number, sortOrder: Enum.SortOrder?) local l = Instance.new("UIListLayout") l.Padding = UDim.new(0, padding) l.SortOrder = sortOrder or Enum.SortOrder.LayoutOrder l.Parent = parent return l end local function mk(parent: Instance, className: string, props: {[string]: any}): any local obj = Instance.new(className) for k, v in pairs(props) do (obj :: any)[k] = v end obj.Parent = parent return obj end local function autoCanvas(scroll: ScrollingFrame, listLayout: UIListLayout) local function update() scroll.CanvasSize = UDim2.new(0, 0, 0, listLayout.AbsoluteContentSize.Y + 8) end update() return listLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(update) end local function textMatches(query: string, name: string): boolean if query == "" then return true end query = string.lower(query) name = string.lower(name) return string.find(name, query, 1, true) ~= nil end local function ripple(button: GuiButton, accent: Color3) local holder = button:FindFirstChild("__ripple") :: Frame? if not holder then holder = Instance.new("Frame") holder.Name = "__ripple" holder.BackgroundTransparency = 1 holder.Size = UDim2.fromScale(1, 1) holder.ClipsDescendants = true holder.ZIndex = button.ZIndex + 5 holder.Parent = button end local mousePos = UIS:GetMouseLocation() local absPos = button.AbsolutePosition local rel = Vector2.new(mousePos.X - absPos.X, mousePos.Y - absPos.Y) local circle = Instance.new("Frame") circle.BackgroundColor3 = accent circle.BackgroundTransparency = 0.65 circle.BorderSizePixel = 0 circle.ZIndex = holder.ZIndex + 1 circle.AnchorPoint = Vector2.new(0.5, 0.5) circle.Position = UDim2.fromOffset(rel.X, rel.Y) circle.Size = UDim2.fromOffset(0, 0) uiCorner(circle, 999) circle.Parent = holder local maxR = math.max(button.AbsoluteSize.X, button.AbsoluteSize.Y) * 1.4 tween(circle, TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { Size = UDim2.fromOffset(maxR, maxR), BackgroundTransparency = 1 }) task.delay(0.4, function() if circle then circle:Destroy() end end) end local function makeShadow(parent: Instance, z: number) local shadow = Instance.new("ImageLabel") shadow.Name = "Shadow" shadow.BackgroundTransparency = 1 shadow.Image = "rbxassetid://1316045217" shadow.ImageTransparency = 0.35 shadow.ScaleType = Enum.ScaleType.Slice shadow.SliceCenter = Rect.new(10, 10, 118, 118) shadow.Size = UDim2.new(1, 24, 1, 24) shadow.Position = UDim2.new(0, -12, 0, -12) shadow.ZIndex = z shadow.Parent = parent return shadow end function Library:Notify(title: string, text: string, duration: number?) duration = duration or 3.0 local sg = self.Instances.ScreenGui if not sg then return end local toastHost = sg:FindFirstChild("ToastHost") :: Frame? if not toastHost then return end local toast = Instance.new("Frame") toast.Name = "Toast" toast.Size = UDim2.fromOffset(340, 78) toast.BackgroundColor3 = self.Theme.Panel toast.BorderSizePixel = 0 toast.ZIndex = 500 uiCorner(toast, 14) uiStroke(toast, 1, self.Theme.StrokeSoft, 0.2) makeShadow(toast, 498) local grad = Instance.new("UIGradient") grad.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, self.Theme.Panel2), ColorSequenceKeypoint.new(1, self.Theme.Panel), }) grad.Rotation = 35 grad.Parent = toast local accentBar = Instance.new("Frame") accentBar.BackgroundColor3 = self.Theme.Accent accentBar.BorderSizePixel = 0 accentBar.Size = UDim2.new(0, 4, 1, -16) accentBar.Position = UDim2.fromOffset(12, 8) accentBar.ZIndex = 501 uiCorner(accentBar, 99) accentBar.Parent = toast local tTitle = Instance.new("TextLabel") tTitle.BackgroundTransparency = 1 tTitle.Text = title tTitle.TextColor3 = self.Theme.Text tTitle.Font = Enum.Font.GothamBold tTitle.TextSize = 14 tTitle.TextXAlignment = Enum.TextXAlignment.Left tTitle.TextTruncate = Enum.TextTruncate.AtEnd tTitle.Position = UDim2.fromOffset(28, 12) tTitle.Size = UDim2.new(1, -40, 0, 18) tTitle.ZIndex = 501 tTitle.Parent = toast local tBody = Instance.new("TextLabel") tBody.BackgroundTransparency = 1 tBody.Text = text tBody.TextColor3 = self.Theme.TextDim tBody.Font = Enum.Font.Gotham tBody.TextSize = 13 tBody.TextWrapped = true tBody.TextXAlignment = Enum.TextXAlignment.Left tBody.TextYAlignment = Enum.TextYAlignment.Top tBody.Position = UDim2.fromOffset(28, 32) tBody.Size = UDim2.new(1, -40, 1, -40) tBody.ZIndex = 501 tBody.Parent = toast local close = Instance.new("TextButton") close.BackgroundTransparency = 1 close.Text = "×" close.TextColor3 = self.Theme.TextDim close.Font = Enum.Font.GothamBold close.TextSize = 18 close.Size = UDim2.fromOffset(26, 26) close.Position = UDim2.new(1, -30, 0, 6) close.ZIndex = 502 close.Parent = toast local idx = #toastHost:GetChildren() toast.Position = UDim2.new(1, 360, 1, -(idx * 88 + 10)) toast.Parent = toastHost tween(toast, TweenInfo.new(0.45, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { Position = UDim2.new(1, -10, 1, -(idx * 88 + 10)) }) local dead = false local function dismiss() if dead then return end dead = true tween(toast, TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.In), { Position = toast.Position + UDim2.fromOffset(360, 0), BackgroundTransparency = 0.2 }) task.delay(0.38, function() if toast then toast:Destroy() end end) end close.MouseButton1Click:Connect(dismiss) task.delay(duration, dismiss) end function Library:SaveConfig(name: string): boolean if not isFileEnv() then return false end local payload = { Version = 1, Flags = self.Flags, } local ok, encoded = pcall(function() return HttpService:JSONEncode(payload) end) if not ok then return false end local path = ("CodeCopilotUI_%s.json"):format(name) local ok2 = pcall(function() writefile(path, encoded) end) return ok2 end function Library:LoadConfig(name: string): boolean if not isFileEnv() then return false end local path = ("CodeCopilotUI_%s.json"):format(name) if not isfile(path) then return false end local ok, decoded = pcall(function() return HttpService:JSONDecode(readfile(path)) end) if not ok then return false end if typeof(decoded) ~= "table" or typeof(decoded.Flags) ~= "table" then return false end self.Flags = decoded.Flags return true end local function makeHover(btn: GuiButton, base: Color3, hover: Color3) local hovering = false btn.MouseEnter:Connect(function() hovering = true tween(btn, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = hover}) end) btn.MouseLeave:Connect(function() hovering = false tween(btn, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = base}) end) end local function clampStep(v: number, minv: number, maxv: number, step: number): number local c = math.clamp(v, minv, maxv) if step <= 0 then return c end local n = math.floor((c - minv) / step + 0.5) return minv + n * step end local function keyToString(k: Enum.KeyCode): string local s = tostring(k) s = s:gsub("Enum.KeyCode.", "") return s end function Library:Destroy() for _, c in ipairs(self.Connections) do pcall(function() c:Disconnect() end) end self.Connections = {} if self.Instances.ScreenGui then self.Instances.ScreenGui:Destroy() self.Instances.ScreenGui = nil end end function Library:CreateWindow(opts: {[string]: any}) opts = opts or {} local title = opts.Title or "CodeCopilot UI" local subtitle = opts.Subtitle or "UI Library" local toggleKey: Enum.KeyCode = opts.Keybind or Enum.KeyCode.RightShift local size = opts.Size or UDim2.fromOffset(860, 560) if self.Instances.ScreenGui then self:Destroy() end local sg = Instance.new("ScreenGui") sg.Name = "CodeCopilotUI" sg.IgnoreGuiInset = true sg.ResetOnSpawn = false sg.ZIndexBehavior = Enum.ZIndexBehavior.Sibling sg.Parent = PlayerGui self.Instances.ScreenGui = sg local toastHost = Instance.new("Frame") toastHost.Name = "ToastHost" toastHost.BackgroundTransparency = 1 toastHost.Size = UDim2.new(1, 0, 1, 0) toastHost.ZIndex = 450 toastHost.Parent = sg local overlay = Instance.new("Frame") overlay.Name = "Overlay" overlay.BackgroundColor3 = Color3.new(0, 0, 0) overlay.BackgroundTransparency = 0.35 overlay.Size = UDim2.new(1, 0, 1, 0) overlay.Visible = false overlay.ZIndex = 2 overlay.Parent = sg local root = Instance.new("Frame") root.Name = "Root" root.BackgroundTransparency = 1 root.Size = UDim2.new(1, 0, 1, 0) root.Parent = sg local main = Instance.new("Frame") main.Name = "Main" main.Size = size main.Position = UDim2.new(0.5, 0, 0.5, 0) main.AnchorPoint = Vector2.new(0.5, 0.5) main.BackgroundColor3 = self.Theme.Background main.BorderSizePixel = 0 main.ZIndex = 10 uiCorner(main, 18) uiStroke(main, 1, self.Theme.StrokeSoft, 0.2) makeShadow(main, 8) main.Parent = root local bgGrad = Instance.new("UIGradient") bgGrad.Rotation = 15 bgGrad.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, self.Theme.Background), ColorSequenceKeypoint.new(1, self.Theme.Panel), }) bgGrad.Parent = main local topbar = Instance.new("Frame") topbar.Name = "Topbar" topbar.BackgroundColor3 = self.Theme.Panel topbar.BorderSizePixel = 0 topbar.Size = UDim2.new(1, 0, 0, 58) topbar.ZIndex = 11 uiCorner(topbar, 18) topbar.Parent = main local topMask = Instance.new("Frame") topMask.BackgroundColor3 = self.Theme.Panel topMask.BorderSizePixel = 0 topMask.Size = UDim2.new(1, 0, 0, 30) topMask.Position = UDim2.new(0, 0, 1, -30) topMask.ZIndex = 11 topMask.Parent = topbar local titleLabel = Instance.new("TextLabel") titleLabel.BackgroundTransparency = 1 titleLabel.Text = title titleLabel.TextColor3 = self.Theme.Text titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 18 titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.Position = UDim2.fromOffset(18, 10) titleLabel.Size = UDim2.new(1, -36, 0, 22) titleLabel.ZIndex = 12 titleLabel.Parent = topbar local subtitleLabel = Instance.new("TextLabel") subtitleLabel.BackgroundTransparency = 1 subtitleLabel.Text = subtitle subtitleLabel.TextColor3 = self.Theme.TextDim subtitleLabel.Font = Enum.Font.Gotham subtitleLabel.TextSize = 13 subtitleLabel.TextXAlignment = Enum.TextXAlignment.Left subtitleLabel.Position = UDim2.fromOffset(18, 32) subtitleLabel.Size = UDim2.new(1, -260, 0, 18) subtitleLabel.ZIndex = 12 subtitleLabel.Parent = topbar local controls = Instance.new("Frame") controls.Name = "TopControls" controls.BackgroundTransparency = 1 controls.Size = UDim2.fromOffset(260, 40) controls.Position = UDim2.new(1, -270, 0, 9) controls.ZIndex = 12 controls.Parent = topbar local searchBox = Instance.new("TextBox") searchBox.Name = "Search" searchBox.BackgroundColor3 = self.Theme.Panel2 searchBox.BorderSizePixel = 0 searchBox.PlaceholderText = "Search controls..." searchBox.PlaceholderColor3 = self.Theme.TextDim searchBox.Text = "" searchBox.ClearTextOnFocus = false searchBox.TextColor3 = self.Theme.Text searchBox.Font = Enum.Font.Gotham searchBox.TextSize = 13 searchBox.Size = UDim2.new(1, -52, 1, 0) searchBox.Position = UDim2.fromOffset(0, 0) searchBox.ZIndex = 13 uiCorner(searchBox, 12) uiStroke(searchBox, 1, self.Theme.StrokeSoft, 0.35) searchBox.Parent = controls local hideBtn = Instance.new("TextButton") hideBtn.Name = "Hide" hideBtn.BackgroundColor3 = self.Theme.Panel2 hideBtn.BorderSizePixel = 0 hideBtn.Text = "≡" hideBtn.TextColor3 = self.Theme.Text hideBtn.Font = Enum.Font.GothamBold hideBtn.TextSize = 16 hideBtn.Size = UDim2.fromOffset(44, 40) hideBtn.Position = UDim2.new(1, -44, 0, 0) hideBtn.ZIndex = 13 uiCorner(hideBtn, 12) uiStroke(hideBtn, 1, self.Theme.StrokeSoft, 0.35) hideBtn.Parent = controls makeHover(hideBtn, self.Theme.Panel2, Color3.fromRGB(34, 34, 46)) local body = Instance.new("Frame") body.Name = "Body" body.BackgroundTransparency = 1 body.Size = UDim2.new(1, -20, 1, -78) body.Position = UDim2.fromOffset(10, 68) body.ZIndex = 11 body.Parent = main local sidebar = Instance.new("Frame") sidebar.Name = "Sidebar" sidebar.BackgroundColor3 = self.Theme.Panel sidebar.BorderSizePixel = 0 sidebar.Size = UDim2.fromOffset(220, 0) sidebar.AutomaticSize = Enum.AutomaticSize.Y sidebar.Position = UDim2.fromOffset(0, 0) sidebar.ZIndex = 11 uiCorner(sidebar, 16) uiStroke(sidebar, 1, self.Theme.StrokeSoft, 0.2) sidebar.Parent = body local sidebarHeader = Instance.new("TextLabel") sidebarHeader.BackgroundTransparency = 1 sidebarHeader.Text = "Tabs" sidebarHeader.TextColor3 = self.Theme.TextDim sidebarHeader.Font = Enum.Font.GothamBold sidebarHeader.TextSize = 12 sidebarHeader.TextXAlignment = Enum.TextXAlignment.Left sidebarHeader.Position = UDim2.fromOffset(14, 12) sidebarHeader.Size = UDim2.new(1, -28, 0, 16) sidebarHeader.ZIndex = 12 sidebarHeader.Parent = sidebar local tabList = Instance.new("ScrollingFrame") tabList.Name = "TabList" tabList.BackgroundTransparency = 1 tabList.BorderSizePixel = 0 tabList.ScrollBarThickness = 3 tabList.ScrollBarImageTransparency = 0.4 tabList.Size = UDim2.new(1, -14, 1, -44) tabList.Position = UDim2.fromOffset(7, 36) tabList.ZIndex = 12 tabList.CanvasSize = UDim2.new(0, 0, 0, 0) tabList.AutomaticCanvasSize = Enum.AutomaticSize.None tabList.Parent = sidebar local tabListLayout = uiList(tabList, 8) uiPadding(tabList, 6, 6, 4, 8) autoCanvas(tabList, tabListLayout) local content = Instance.new("Frame") content.Name = "Content" content.BackgroundColor3 = self.Theme.Panel content.BorderSizePixel = 0 content.Position = UDim2.fromOffset(230, 0) content.Size = UDim2.new(1, -230, 1, 0) content.ZIndex = 11 uiCorner(content, 16) uiStroke(content, 1, self.Theme.StrokeSoft, 0.2) content.Parent = body local pages = Instance.new("Folder") pages.Name = "Pages" pages.Parent = content local footer = Instance.new("TextLabel") footer.Name = "Footer" footer.BackgroundTransparency = 1 footer.Text = ("Press %s to toggle UI"):format(keyToString(toggleKey)) footer.TextColor3 = self.Theme.TextDim footer.Font = Enum.Font.Gotham footer.TextSize = 12 footer.TextXAlignment = Enum.TextXAlignment.Right footer.Position = UDim2.new(0, 0, 1, -18) footer.Size = UDim2.new(1, -14, 0, 16) footer.ZIndex = 12 footer.Parent = content local window = {} window._tabs = {} window._activeTab = nil window._main = main window._content = content window._pages = pages window._tabList = tabList window._overlay = overlay window._searchBox = searchBox local function setVisible(v: boolean) Library.Visible = v if v then main.Visible = true tween(main, TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Size = size}) tween(main, TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Position = UDim2.new(0.5, 0, 0.5, 0)}) else tween(main, TweenInfo.new(0.25, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Size = UDim2.fromOffset(size.X.Offset, 26)}) tween(main, TweenInfo.new(0.25, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Position = UDim2.new(0.5, 0, 0, -20)}) task.delay(0.26, function() main.Visible = false end) end end table.insert(self.Connections, UIS.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == toggleKey then setVisible(not Library.Visible) end end)) hideBtn.MouseButton1Click:Connect(function() ripple(hideBtn, self.Theme.Accent2) setVisible(not Library.Visible) end) -- Dragging local dragArea = topbar local function startDrag(input: InputObject) Library.Dragging = true Library.DragOffset = Vector2.new(input.Position.X, input.Position.Y) - main.AbsolutePosition end local function endDrag() Library.Dragging = false end table.insert(self.Connections, dragArea.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then startDrag(input) end end)) table.insert(self.Connections, UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then endDrag() end end)) table.insert(self.Connections, UIS.InputChanged:Connect(function(input) if not Library.Dragging then return end if input.UserInputType == Enum.UserInputType.MouseMovement then local pos = Vector2.new(input.Position.X, input.Position.Y) - Library.DragOffset main.Position = UDim2.fromOffset(pos.X + main.Size.X.Offset * 0.0, pos.Y + main.Size.Y.Offset * 0.0) end end)) -- Search searchBox:GetPropertyChangedSignal("Text"):Connect(function() Library.SearchQuery = searchBox.Text or "" for _, tabObj in pairs(window._tabs) do if tabObj and tabObj._applySearch then tabObj:_applySearch(Library.SearchQuery) end end end) local function setActive(tabObj) if window._activeTab == tabObj then return end if window._activeTab then window._activeTab._page.Visible = false tween(window._activeTab._button, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { BackgroundColor3 = Library.Theme.Panel2 }) window._activeTab._label.TextColor3 = Library.Theme.TextDim end window._activeTab = tabObj tabObj._page.Visible = true tween(tabObj._button, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { BackgroundColor3 = Library.Theme.Accent }) tabObj._label.TextColor3 = Library.Theme.Text end function window:Tab(name: string) local tab = {} tab.Name = name tab._sections = {} tab._controls = {} local tabBtn = Instance.new("TextButton") tabBtn.Name = "TabBtn_" .. name tabBtn.BackgroundColor3 = Library.Theme.Panel2 tabBtn.BorderSizePixel = 0 tabBtn.Text = "" tabBtn.AutoButtonColor = false tabBtn.Size = UDim2.new(1, 0, 0, 44) tabBtn.ZIndex = 13 uiCorner(tabBtn, 12) uiStroke(tabBtn, 1, Library.Theme.StrokeSoft, 0.35) tabBtn.Parent = tabList makeHover(tabBtn, Library.Theme.Panel2, Color3.fromRGB(34, 34, 46)) local dot = Instance.new("Frame") dot.BackgroundColor3 = Library.Theme.Accent2 dot.BorderSizePixel = 0 dot.Size = UDim2.fromOffset(8, 8) dot.Position = UDim2.fromOffset(14, 18) dot.ZIndex = 14 uiCorner(dot, 99) dot.Parent = tabBtn local tabLabel = Instance.new("TextLabel") tabLabel.BackgroundTransparency = 1 tabLabel.Text = name tabLabel.TextColor3 = Library.Theme.TextDim tabLabel.Font = Enum.Font.GothamBold tabLabel.TextSize = 14 tabLabel.TextXAlignment = Enum.TextXAlignment.Left tabLabel.Position = UDim2.fromOffset(28, 12) tabLabel.Size = UDim2.new(1, -40, 0, 20) tabLabel.ZIndex = 14 tabLabel.Parent = tabBtn local page = Instance.new("ScrollingFrame") page.Name = "Page_" .. name page.BackgroundTransparency = 1 page.BorderSizePixel = 0 page.ScrollBarThickness = 4 page.ScrollBarImageTransparency = 0.4 page.Size = UDim2.new(1, 0, 1, -26) page.Position = UDim2.fromOffset(0, 0) page.Visible = false page.ZIndex = 12 page.CanvasSize = UDim2.new(0, 0, 0, 0) page.Parent = pages uiPadding(page, 14, 14, 14, 14) local pageLayout = uiList(page, 12) autoCanvas(page, pageLayout) tab._button = tabBtn tab._label = tabLabel tab._page = page function tab:_applySearch(query: string) for _, ctrl in ipairs(self._controls) do local ok = textMatches(query, ctrl._searchText or "") if ctrl._root then ctrl._root.Visible = ok end end for _, sec in ipairs(self._sections) do if sec and sec._recalcVisibility then sec:_recalcVisibility() end end end tabBtn.MouseButton1Click:Connect(function() ripple(tabBtn, Library.Theme.Accent2) setActive(tab) end) function tab:Section(titleText: string) local section = {} section._controls = {} local card = Instance.new("Frame") card.Name = "Section_" .. titleText card.BackgroundColor3 = Library.Theme.Panel2 card.BorderSizePixel = 0 card.Size = UDim2.new(1, 0, 0, 100) card.AutomaticSize = Enum.AutomaticSize.Y card.ZIndex = 12 uiCorner(card, 16) uiStroke(card, 1, Library.Theme.StrokeSoft, 0.25) card.Parent = page local g = Instance.new("UIGradient") g.Rotation = 25 g.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Library.Theme.Panel2), ColorSequenceKeypoint.new(1, Library.Theme.Panel), }) g.Parent = card local header = Instance.new("TextLabel") header.BackgroundTransparency = 1 header.Text = titleText header.TextColor3 = Library.Theme.Text header.Font = Enum.Font.GothamBold header.TextSize = 14 header.TextXAlignment = Enum.TextXAlignment.Left header.Position = UDim2.fromOffset(14, 12) header.Size = UDim2.new(1, -28, 0, 18) header.ZIndex = 13 header.Parent = card local inner = Instance.new("Frame") inner.BackgroundTransparency = 1 inner.Size = UDim2.new(1, -20, 1, -44) inner.Position = UDim2.fromOffset(10, 36) inner.AutomaticSize = Enum.AutomaticSize.Y inner.ZIndex = 13 inner.Parent = card local innerLayout = uiList(inner, 10) autoCanvas(page, pageLayout) local function mkRow(height: number) local row = Instance.new("Frame") row.BackgroundColor3 = Color3.fromRGB(0, 0, 0) row.BackgroundTransparency = 0.55 row.BorderSizePixel = 0 row.Size = UDim2.new(1, 0, 0, height) row.ZIndex = 13 uiCorner(row, 12) uiStroke(row, 1, Library.Theme.StrokeSoft, 0.5) row.Parent = inner local grad2 = Instance.new("UIGradient") grad2.Rotation = 10 grad2.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(210, 210, 210)), }) grad2.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.92), NumberSequenceKeypoint.new(1, 0.98), }) grad2.Parent = row uiPadding(row, 12, 12, 10, 10) return row end function section:_recalcVisibility() local anyVisible = false for _, c in ipairs(self._controls) do if c._root and c._root.Visible then anyVisible = true break end end card.Visible = anyVisible or (Library.SearchQuery == "") end local function registerControl(ctrl, searchText: string) ctrl._searchText = searchText table.insert(tab._controls, ctrl) table.insert(section._controls, ctrl) section:_recalcVisibility() end function section:Button(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Button" local cb: Callback<()> = cfg.Callback or function() end local row = mkRow(44) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, -120, 1, 0) label.ZIndex = 14 label.Parent = row local btn = Instance.new("TextButton") btn.BackgroundColor3 = Library.Theme.Accent btn.BorderSizePixel = 0 btn.Text = cfg.ButtonText or "Run" btn.TextColor3 = Library.Theme.Text btn.Font = Enum.Font.GothamBold btn.TextSize = 13 btn.Size = UDim2.fromOffset(96, 28) btn.Position = UDim2.new(1, -96, 0.5, -14) btn.ZIndex = 15 uiCorner(btn, 10) uiStroke(btn, 1, Library.Theme.StrokeSoft, 0.4) btn.Parent = row btn.MouseButton1Click:Connect(function() ripple(btn, Library.Theme.Accent2) task.spawn(function() local ok, err = pcall(cb) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end) makeHover(btn, Library.Theme.Accent, Color3.fromRGB(150, 120, 255)) local ctrl = {_root = row} registerControl(ctrl, name) return ctrl end function section:Toggle(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Toggle" local flag = cfg.Flag or name local default = cfg.Default == true local cb: Callback = cfg.Callback or function(_) end Library.Flags[flag] = (Library.Flags[flag] ~= nil) and Library.Flags[flag] or default local row = mkRow(44) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, -120, 1, 0) label.ZIndex = 14 label.Parent = row local pill = Instance.new("TextButton") pill.BackgroundColor3 = Color3.fromRGB(40, 40, 52) pill.BorderSizePixel = 0 pill.Text = "" pill.AutoButtonColor = false pill.Size = UDim2.fromOffset(54, 28) pill.Position = UDim2.new(1, -54, 0.5, -14) pill.ZIndex = 15 uiCorner(pill, 999) uiStroke(pill, 1, Library.Theme.StrokeSoft, 0.45) pill.Parent = row local knob = Instance.new("Frame") knob.BackgroundColor3 = Library.Theme.Text knob.BorderSizePixel = 0 knob.Size = UDim2.fromOffset(22, 22) knob.Position = UDim2.fromOffset(3, 3) knob.ZIndex = 16 uiCorner(knob, 999) knob.Parent = pill local function render(v: boolean, instant: boolean?) local toPos = v and UDim2.fromOffset(54 - 25, 3) or UDim2.fromOffset(3, 3) local toBg = v and Library.Theme.Accent or Color3.fromRGB(40, 40, 52) if instant then knob.Position = toPos pill.BackgroundColor3 = toBg else tween(knob, TweenInfo.new(0.2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Position = toPos}) tween(pill, TweenInfo.new(0.2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {BackgroundColor3 = toBg}) end end render(Library.Flags[flag], true) local function set(v: boolean) Library.Flags[flag] = v render(v, false) task.spawn(function() local ok, err = pcall(function() cb(v) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end pill.MouseButton1Click:Connect(function() ripple(pill, Library.Theme.Accent2) set(not Library.Flags[flag]) end) row.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then set(not Library.Flags[flag]) end end) local ctrl = { _root = row, Set = set, Get = function() return Library.Flags[flag] end, Flag = flag, } registerControl(ctrl, name) return ctrl end function section:Slider(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Slider" local flag = cfg.Flag or name local minv = tonumber(cfg.Min) or 0 local maxv = tonumber(cfg.Max) or 100 local step = tonumber(cfg.Step) or 1 local default = tonumber(cfg.Default) or minv local cb: Callback = cfg.Callback or function(_) end if minv > maxv then minv, maxv = maxv, minv end Library.Flags[flag] = (Library.Flags[flag] ~= nil) and Library.Flags[flag] or clampStep(default, minv, maxv, step) local row = mkRow(56) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, -120, 0, 18) label.ZIndex = 14 label.Parent = row local valueLabel = Instance.new("TextLabel") valueLabel.BackgroundTransparency = 1 valueLabel.Text = tostring(Library.Flags[flag]) valueLabel.TextColor3 = Library.Theme.TextDim valueLabel.Font = Enum.Font.Gotham valueLabel.TextSize = 13 valueLabel.TextXAlignment = Enum.TextXAlignment.Right valueLabel.Size = UDim2.new(0, 100, 0, 18) valueLabel.Position = UDim2.new(1, -100, 0, 0) valueLabel.ZIndex = 14 valueLabel.Parent = row local bar = Instance.new("Frame") bar.BackgroundColor3 = Color3.fromRGB(35, 35, 46) bar.BorderSizePixel = 0 bar.Size = UDim2.new(1, 0, 0, 10) bar.Position = UDim2.fromOffset(0, 30) bar.ZIndex = 14 uiCorner(bar, 999) uiStroke(bar, 1, Library.Theme.StrokeSoft, 0.55) bar.Parent = row local fill = Instance.new("Frame") fill.BackgroundColor3 = Library.Theme.Accent fill.BorderSizePixel = 0 fill.Size = UDim2.new(0, 0, 1, 0) fill.ZIndex = 15 uiCorner(fill, 999) fill.Parent = bar local grab = Instance.new("Frame") grab.BackgroundColor3 = Library.Theme.Text grab.BorderSizePixel = 0 grab.Size = UDim2.fromOffset(14, 14) grab.AnchorPoint = Vector2.new(0.5, 0.5) grab.Position = UDim2.new(0, 0, 0.5, 0) grab.ZIndex = 16 uiCorner(grab, 999) grab.Parent = bar local dragging = false local function pctFromValue(v: number): number return (v - minv) / (maxv - minv) end local function valueFromPct(p: number): number return clampStep(minv + p * (maxv - minv), minv, maxv, step) end local function render(v: number, instant: boolean?) local p = math.clamp(pctFromValue(v), 0, 1) valueLabel.Text = tostring(v) if instant then fill.Size = UDim2.new(p, 0, 1, 0) grab.Position = UDim2.new(p, 0, 0.5, 0) else tween(fill, TweenInfo.new(0.12, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(p, 0, 1, 0)}) tween(grab, TweenInfo.new(0.12, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = UDim2.new(p, 0, 0.5, 0)}) end end render(Library.Flags[flag], true) local function set(v: number) Library.Flags[flag] = v render(v, false) task.spawn(function() local ok, err = pcall(function() cb(v) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end local function updateFromMouse() local mx = UIS:GetMouseLocation().X local x0 = bar.AbsolutePosition.X local w = bar.AbsoluteSize.X local p = (mx - x0) / w p = math.clamp(p, 0, 1) set(valueFromPct(p)) end bar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true updateFromMouse() end end) UIS.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) UIS.InputChanged:Connect(function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then updateFromMouse() end end) local ctrl = { _root = row, Set = set, Get = function() return Library.Flags[flag] end, Flag = flag, } registerControl(ctrl, name) return ctrl end function section:Textbox(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Textbox" local flag = cfg.Flag or name local placeholder = cfg.Placeholder or "Type..." local default = cfg.Default or "" local cb: Callback = cfg.Callback or function(_) end Library.Flags[flag] = (Library.Flags[flag] ~= nil) and Library.Flags[flag] or default local row = mkRow(52) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, 0, 0, 18) label.ZIndex = 14 label.Parent = row local box = Instance.new("TextBox") box.BackgroundColor3 = Color3.fromRGB(34, 34, 46) box.BorderSizePixel = 0 box.Text = tostring(Library.Flags[flag]) box.PlaceholderText = placeholder box.PlaceholderColor3 = Library.Theme.TextDim box.ClearTextOnFocus = false box.TextColor3 = Library.Theme.Text box.Font = Enum.Font.Gotham box.TextSize = 13 box.Size = UDim2.new(1, 0, 0, 26) box.Position = UDim2.fromOffset(0, 22) box.ZIndex = 15 uiCorner(box, 10) uiStroke(box, 1, Library.Theme.StrokeSoft, 0.55) box.Parent = row local function set(v: string) Library.Flags[flag] = v task.spawn(function() local ok, err = pcall(function() cb(v) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end box.FocusLost:Connect(function() set(box.Text) end) local ctrl = { _root = row, Set = function(v: string) box.Text = v; set(v) end, Get = function() return tostring(Library.Flags[flag]) end, Flag = flag, } registerControl(ctrl, name) return ctrl end function section:Dropdown(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Dropdown" local flag = cfg.Flag or name local list = cfg.List or {} local multi = cfg.Multi == true local default = cfg.Default local cb = cfg.Callback or function(_) end local function normalizeDefault() if multi then if typeof(default) == "table" then return deepCopy(default) end return {} end if default == nil then return (#list > 0) and list[1] or "" end return default end Library.Flags[flag] = (Library.Flags[flag] ~= nil) and Library.Flags[flag] or normalizeDefault() local row = mkRow(52) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, -40, 0, 18) label.ZIndex = 14 label.Parent = row local openBtn = Instance.new("TextButton") openBtn.BackgroundColor3 = Color3.fromRGB(34, 34, 46) openBtn.BorderSizePixel = 0 openBtn.Text = "" openBtn.AutoButtonColor = false openBtn.Size = UDim2.new(1, 0, 0, 26) openBtn.Position = UDim2.fromOffset(0, 22) openBtn.ZIndex = 15 uiCorner(openBtn, 10) uiStroke(openBtn, 1, Library.Theme.StrokeSoft, 0.55) openBtn.Parent = row makeHover(openBtn, Color3.fromRGB(34, 34, 46), Color3.fromRGB(40, 40, 55)) local valueText = Instance.new("TextLabel") valueText.BackgroundTransparency = 1 valueText.TextColor3 = Library.Theme.TextDim valueText.Font = Enum.Font.Gotham valueText.TextSize = 13 valueText.TextXAlignment = Enum.TextXAlignment.Left valueText.Size = UDim2.new(1, -30, 1, 0) valueText.Position = UDim2.fromOffset(10, 0) valueText.ZIndex = 16 valueText.Parent = openBtn local caret = Instance.new("TextLabel") caret.BackgroundTransparency = 1 caret.Text = "▾" caret.TextColor3 = Library.Theme.TextDim caret.Font = Enum.Font.GothamBold caret.TextSize = 14 caret.Size = UDim2.fromOffset(20, 20) caret.Position = UDim2.new(1, -22, 0.5, -10) caret.ZIndex = 16 caret.Parent = openBtn local popup = Instance.new("Frame") popup.BackgroundColor3 = Library.Theme.Panel popup.BorderSizePixel = 0 popup.Visible = false popup.Size = UDim2.new(1, 0, 0, 160) popup.Position = UDim2.fromOffset(0, 52) popup.ZIndex = 80 uiCorner(popup, 12) uiStroke(popup, 1, Library.Theme.StrokeSoft, 0.25) makeShadow(popup, 78) popup.Parent = row local popPad = uiPadding(popup, 8, 8, 8, 8) local popList = Instance.new("ScrollingFrame") popList.BackgroundTransparency = 1 popList.BorderSizePixel = 0 popList.ScrollBarThickness = 4 popList.ScrollBarImageTransparency = 0.4 popList.Size = UDim2.new(1, 0, 1, 0) popList.ZIndex = 81 popList.Parent = popup local popLayout = uiList(popList, 6) autoCanvas(popList, popLayout) local function isSelected(item: any): boolean if multi then local sel = Library.Flags[flag] if typeof(sel) ~= "table" then return false end return sel[item] == true end return Library.Flags[flag] == item end local function renderValue() if multi then local sel = Library.Flags[flag] local parts = {} if typeof(sel) == "table" then for k, v in pairs(sel) do if v == true then table.insert(parts, tostring(k)) end end end table.sort(parts) valueText.Text = (#parts > 0) and table.concat(parts, ", ") or "None" else valueText.Text = tostring(Library.Flags[flag] or "") end end local function fireCallback() task.spawn(function() local ok, err = pcall(function() cb(Library.Flags[flag]) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end local optionButtons = {} local function rebuild() for _, ch in ipairs(popList:GetChildren()) do if ch:IsA("GuiObject") then ch:Destroy() end end optionButtons = {} for _, item in ipairs(list) do local opt = Instance.new("TextButton") opt.BackgroundColor3 = Color3.fromRGB(34, 34, 46) opt.BorderSizePixel = 0 opt.Text = "" opt.AutoButtonColor = false opt.Size = UDim2.new(1, 0, 0, 34) opt.ZIndex = 82 uiCorner(opt, 10) uiStroke(opt, 1, Library.Theme.StrokeSoft, 0.55) opt.Parent = popList makeHover(opt, Color3.fromRGB(34, 34, 46), Color3.fromRGB(42, 42, 58)) local t = Instance.new("TextLabel") t.BackgroundTransparency = 1 t.Text = tostring(item) t.TextColor3 = Library.Theme.Text t.Font = Enum.Font.Gotham t.TextSize = 13 t.TextXAlignment = Enum.TextXAlignment.Left t.Size = UDim2.new(1, -40, 1, 0) t.Position = UDim2.fromOffset(10, 0) t.ZIndex = 83 t.Parent = opt local check = Instance.new("TextLabel") check.BackgroundTransparency = 1 check.Text = "✓" check.TextColor3 = Library.Theme.Good check.Font = Enum.Font.GothamBold check.TextSize = 14 check.Size = UDim2.fromOffset(18, 18) check.Position = UDim2.new(1, -24, 0.5, -9) check.ZIndex = 83 check.Visible = false check.Parent = opt local function renderOpt() check.Visible = isSelected(item) if check.Visible then opt.BackgroundColor3 = Color3.fromRGB(40, 40, 58) else opt.BackgroundColor3 = Color3.fromRGB(34, 34, 46) end end renderOpt() opt.MouseButton1Click:Connect(function() ripple(opt, Library.Theme.Accent2) if multi then local sel = Library.Flags[flag] if typeof(sel) ~= "table" then sel = {} end sel[item] = not (sel[item] == true) Library.Flags[flag] = sel else Library.Flags[flag] = item popup.Visible = false Library.Instances.ScreenGui and (Library.Instances.ScreenGui:FindFirstChild("Overlay") :: Frame?).Visible = false end renderValue() for _, r in pairs(optionButtons) do r() end fireCallback() end) optionButtons[item] = renderOpt end renderValue() end rebuild() local function openClose() local now = not popup.Visible popup.Visible = now overlay.Visible = now if now then popup.Size = UDim2.new(1, 0, 0, 0) tween(popup, TweenInfo.new(0.22, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Size = UDim2.new(1, 0, 0, 160)}) end end openBtn.MouseButton1Click:Connect(function() ripple(openBtn, Library.Theme.Accent2) openClose() end) overlay.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then if popup.Visible then popup.Visible = false overlay.Visible = false end end end) local ctrl = { _root = row, SetList = function(newList: {any}) list = newList rebuild() end, Set = function(v: any) Library.Flags[flag] = v renderValue() fireCallback() for _, r in pairs(optionButtons) do r() end end, Get = function() return Library.Flags[flag] end, Flag = flag, } registerControl(ctrl, name) return ctrl end function section:Keybind(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Keybind" local flag = cfg.Flag or name local defaultKey: Enum.KeyCode = cfg.Default or Enum.KeyCode.K local cb: Callback = cfg.Callback or function(_) end Library.Flags[flag] = (Library.Flags[flag] ~= nil) and Library.Flags[flag] or defaultKey local row = mkRow(44) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, -120, 1, 0) label.ZIndex = 14 label.Parent = row local btn = Instance.new("TextButton") btn.BackgroundColor3 = Color3.fromRGB(34, 34, 46) btn.BorderSizePixel = 0 btn.Text = keyToString(Library.Flags[flag]) btn.TextColor3 = Library.Theme.Text btn.Font = Enum.Font.GothamBold btn.TextSize = 13 btn.Size = UDim2.fromOffset(96, 28) btn.Position = UDim2.new(1, -96, 0.5, -14) btn.ZIndex = 15 btn.AutoButtonColor = false uiCorner(btn, 10) uiStroke(btn, 1, Library.Theme.StrokeSoft, 0.55) btn.Parent = row makeHover(btn, Color3.fromRGB(34, 34, 46), Color3.fromRGB(42, 42, 58)) local waiting = false btn.MouseButton1Click:Connect(function() ripple(btn, Library.Theme.Accent2) waiting = true btn.Text = "Press..." end) table.insert(Library.Connections, UIS.InputBegan:Connect(function(input, gp) if gp then return end if waiting then if input.KeyCode ~= Enum.KeyCode.Unknown then waiting = false Library.Flags[flag] = input.KeyCode btn.Text = keyToString(input.KeyCode) task.spawn(function() local ok, err = pcall(function() cb(input.KeyCode) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end return end if input.KeyCode == (Library.Flags[flag] :: Enum.KeyCode) then task.spawn(function() local ok, err = pcall(function() cb(Library.Flags[flag]) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end end)) local ctrl = { _root = row, Set = function(k: Enum.KeyCode) Library.Flags[flag] = k; btn.Text = keyToString(k) end, Get = function() return Library.Flags[flag] end, Flag = flag, } registerControl(ctrl, name) return ctrl end function section:ColorPicker(cfg: {[string]: any}) cfg = cfg or {} local name = cfg.Name or "Color" local flag = cfg.Flag or name local default: Color3 = cfg.Default or Library.Theme.Accent local cb: Callback = cfg.Callback or function(_) end Library.Flags[flag] = (Library.Flags[flag] ~= nil) and Library.Flags[flag] or default local row = mkRow(52) local label = Instance.new("TextLabel") label.BackgroundTransparency = 1 label.Text = name label.TextColor3 = Library.Theme.Text label.Font = Enum.Font.GothamBold label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Size = UDim2.new(1, -120, 0, 18) label.ZIndex = 14 label.Parent = row local btn = Instance.new("TextButton") btn.BackgroundColor3 = Color3.fromRGB(34, 34, 46) btn.BorderSizePixel = 0 btn.Text = "" btn.AutoButtonColor = false btn.Size = UDim2.new(1, 0, 0, 26) btn.Position = UDim2.fromOffset(0, 22) btn.ZIndex = 15 uiCorner(btn, 10) uiStroke(btn, 1, Library.Theme.StrokeSoft, 0.55) btn.Parent = row local swatch = Instance.new("Frame") swatch.BackgroundColor3 = (Library.Flags[flag] :: Color3) swatch.BorderSizePixel = 0 swatch.Size = UDim2.fromOffset(40, 18) swatch.Position = UDim2.new(1, -50, 0.5, -9) swatch.ZIndex = 16 uiCorner(swatch, 8) uiStroke(swatch, 1, Library.Theme.StrokeSoft, 0.4) swatch.Parent = btn local txt = Instance.new("TextLabel") txt.BackgroundTransparency = 1 txt.Text = "Pick color (HSV)" txt.TextColor3 = Library.Theme.TextDim txt.Font = Enum.Font.Gotham txt.TextSize = 13 txt.TextXAlignment = Enum.TextXAlignment.Left txt.Size = UDim2.new(1, -60, 1, 0) txt.Position = UDim2.fromOffset(10, 0) txt.ZIndex = 16 txt.Parent = btn local popup = Instance.new("Frame") popup.BackgroundColor3 = Library.Theme.Panel popup.BorderSizePixel = 0 popup.Visible = false popup.Size = UDim2.new(1, 0, 0, 170) popup.Position = UDim2.fromOffset(0, 52) popup.ZIndex = 80 uiCorner(popup, 12) uiStroke(popup, 1, Library.Theme.StrokeSoft, 0.25) makeShadow(popup, 78) popup.Parent = row uiPadding(popup, 10, 10, 10, 10) local lay = uiList(popup, 8) local function mkSliderLine(labelText: string, minv: number, maxv: number, v0: number, onChange: (number)->()) local line = Instance.new("Frame") line.BackgroundTransparency = 1 line.Size = UDim2.new(1, 0, 0, 42) line.ZIndex = 81 line.Parent = popup local l = Instance.new("TextLabel") l.BackgroundTransparency = 1 l.Text = labelText l.TextColor3 = Library.Theme.Text l.Font = Enum.Font.GothamBold l.TextSize = 13 l.TextXAlignment = Enum.TextXAlignment.Left l.Size = UDim2.new(1, -60, 0, 18) l.ZIndex = 82 l.Parent = line local vLabel = Instance.new("TextLabel") vLabel.BackgroundTransparency = 1 vLabel.Text = tostring(v0) vLabel.TextColor3 = Library.Theme.TextDim vLabel.Font = Enum.Font.Gotham vLabel.TextSize = 12 vLabel.TextXAlignment = Enum.TextXAlignment.Right vLabel.Size = UDim2.new(0, 60, 0, 18) vLabel.Position = UDim2.new(1, -60, 0, 0) vLabel.ZIndex = 82 vLabel.Parent = line local bar = Instance.new("Frame") bar.BackgroundColor3 = Color3.fromRGB(35, 35, 46) bar.BorderSizePixel = 0 bar.Size = UDim2.new(1, 0, 0, 10) bar.Position = UDim2.fromOffset(0, 26) bar.ZIndex = 82 uiCorner(bar, 999) uiStroke(bar, 1, Library.Theme.StrokeSoft, 0.55) bar.Parent = line local fill = Instance.new("Frame") fill.BackgroundColor3 = Library.Theme.Accent2 fill.BorderSizePixel = 0 fill.Size = UDim2.new(0, 0, 1, 0) fill.ZIndex = 83 uiCorner(fill, 999) fill.Parent = bar local dragging = false local function render(v: number) local p = (v - minv) / (maxv - minv) p = math.clamp(p, 0, 1) fill.Size = UDim2.new(p, 0, 1, 0) vLabel.Text = string.format("%.3f", v) end render(v0) local function setFromMouse() local mx = UIS:GetMouseLocation().X local x0 = bar.AbsolutePosition.X local w = bar.AbsoluteSize.X local p = math.clamp((mx - x0) / w, 0, 1) local v = minv + p * (maxv - minv) render(v) onChange(v) end bar.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true setFromMouse() end end) UIS.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) UIS.InputChanged:Connect(function(i) if dragging and i.UserInputType == Enum.UserInputType.MouseMovement then setFromMouse() end end) return function(v: number) render(v) end end local color = (Library.Flags[flag] :: Color3) local h, s, v = Color3.toHSV(color) local setH = mkSliderLine("Hue", 0, 1, h, function(n) h = n end) local setS = mkSliderLine("Saturation", 0, 1, s, function(n) s = n end) local setV = mkSliderLine("Value", 0, 1, v, function(n) v = n end) local function apply() local c = Color3.fromHSV(h, s, v) Library.Flags[flag] = c swatch.BackgroundColor3 = c task.spawn(function() local ok, err = pcall(function() cb(c) end) if not ok then Library:Notify("Callback error", tostring(err), 4) end end) end local applyBtn = Instance.new("TextButton") applyBtn.BackgroundColor3 = Library.Theme.Accent applyBtn.BorderSizePixel = 0 applyBtn.Text = "Apply" applyBtn.TextColor3 = Library.Theme.Text applyBtn.Font = Enum.Font.GothamBold applyBtn.TextSize = 13 applyBtn.Size = UDim2.new(1, 0, 0, 34) applyBtn.ZIndex = 82 uiCorner(applyBtn, 10) uiStroke(applyBtn, 1, Library.Theme.StrokeSoft, 0.4) applyBtn.Parent = popup makeHover(applyBtn, Library.Theme.Accent, Color3.fromRGB(150, 120, 255)) applyBtn.MouseButton1Click:Connect(function() ripple(applyBtn, Library.Theme.Accent2) apply() popup.Visible = false overlay.Visible = false end) btn.MouseButton1Click:Connect(function() ripple(btn, Library.Theme.Accent2) popup.Visible = not popup.Visible overlay.Visible = popup.Visible if popup.Visible then popup.Size = UDim2.new(1, 0, 0, 0) tween(popup, TweenInfo.new(0.22, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Size = UDim2.new(1, 0, 0, 170)}) end end) overlay.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then if popup.Visible then popup.Visible = false overlay.Visible = false end end end) local ctrl = { _root = row, Set = function(c: Color3) Library.Flags[flag] = c swatch.BackgroundColor3 = c local hh, ss, vv = Color3.toHSV(c) h, s, v = hh, ss, vv setH(h) setS(s) setV(v) apply() end, Get = function() return Library.Flags[flag] end, Flag = flag, } registerControl(ctrl, name) return ctrl end tab._sections[#tab._sections + 1] = section return section end window._tabs[#window._tabs + 1] = tab if not window._activeTab then setActive(tab) end return tab end Library:Notify("Loaded", "UI library initialized.", 2.5) return window end return Library