-- ========================================================================= -- GrieferHub UI Library (GHUI) v1.0 -- Единый API для своих скриптов: окно, табы, кнопки, тумблеры, слайдеры, -- дропдауны, инпуты. Загрузка одной строкой: -- -- local UI = loadstring(game:HttpGet("https://ВАШ_ДОМЕН/library/raw/ghui"))() -- local Window = UI:CreateWindow({ Title = "My Hub" }) -- local Tab = Window:CreateTab("Main") -- Tab:CreateButton({ Title = "Hello", Callback = function() print("hi") end }) -- -- Совместимо с Lua 5.1 / Luau (все популярные экзекьюторы). -- ========================================================================= local HttpService = game:GetService("HttpService") local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local GHUI = {} GHUI.Version = "1.0.0" GHUI.__index = GHUI -- ---------------------------------------------------------------- helpers local function safe_parent() if type(gethui) == "function" then local ok, ui = pcall(gethui) if ok and ui then return ui end end local ok2, core = pcall(function() return game:GetService("CoreGui") end) if ok2 and core then return core end return LocalPlayer:WaitForChild("PlayerGui") end local function corner(parent, radius) local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, radius or 8) c.Parent = parent return c end local function make(class, props) local inst = Instance.new(class) for k, v in pairs(props or {}) do inst[k] = v end return inst end local function pad(parent, l, t, r, b) local p = Instance.new("UIPadding") p.PaddingLeft = UDim.new(0, l or 0) p.PaddingTop = UDim.new(0, t or 0) p.PaddingRight = UDim.new(0, r or 0) p.PaddingBottom = UDim.new(0, b or 0) p.Parent = parent return p end -- Возвращает "цвета" темы окна (тёмная база + акцент автора скрипта) local function build_theme(accent) return { accent = accent or Color3.fromRGB(0, 255, 127), bg = Color3.fromRGB(12, 12, 14), bgLight = Color3.fromRGB(18, 18, 20), bgElement = Color3.fromRGB(24, 24, 28), border = Color3.fromRGB(38, 38, 42), text = Color3.fromRGB(235, 235, 240), muted = Color3.fromRGB(150, 150, 158), } end -- ------------------------------------------------------- element builders local function make_label(parent, text, theme, size) local l = make("TextLabel", { Parent = parent, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, size or 16), Font = Enum.Font.Gotham, Text = tostring(text), TextColor3 = theme.muted, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) return l end local function make_title_row(parent, titleText, theme) local t = make("TextLabel", { Parent = parent, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 16), Font = Enum.Font.GothamBold, Text = tostring(titleText), TextColor3 = theme.text, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) return t end local function make_element_frame(parent, theme, height) local f = make("Frame", { Parent = parent, BackgroundColor3 = theme.bgElement, BorderSizePixel = 0, Size = UDim2.new(1, 0, 0, height or 42), }) corner(f, 8) return f end -- ---------------------------------------------------------------- window -- UI:CreateWindow({ Title = "My Hub", Accent = Color3.fromRGB(...), -- Footer = "discord.gg/..." }) -> Window function GHUI:CreateWindow(config) config = config or {} local theme = build_theme(config.Accent) local titleText = config.Title or "GrieferHub" local screen = make("ScreenGui", { Name = "GHUI_" .. tostring(math.random(100000, 999999)) }) screen.ResetOnSpawn = false screen.ZIndexBehavior = Enum.ZIndexBehavior.Sibling pcall(function() screen.Parent = safe_parent() end) local main = make("Frame", { Parent = screen, BackgroundColor3 = theme.bg, BorderSizePixel = 0, Position = UDim2.new(0.5, -290, 0.5, -190), Size = UDim2.new(0, 580, 0, 380), Active = true, }) corner(main, 12) -- top bar (title + minimize + close), also the drag handle local topBar = make("Frame", { Parent = main, BackgroundColor3 = theme.bgLight, BorderSizePixel = 0, Size = UDim2.new(1, 0, 0, 40), }) corner(topBar, 12) local titleLabel = make("TextLabel", { Parent = topBar, BackgroundTransparency = 1, Position = UDim2.new(0, 16, 0, 0), Size = UDim2.new(1, -110, 1, 0), Font = Enum.Font.GothamBold, Text = tostring(titleText), TextColor3 = theme.accent, TextSize = 16, TextXAlignment = Enum.TextXAlignment.Left, TextTruncate = Enum.TextTruncate.AtEnd, }) local closeBtn = make("TextButton", { Parent = topBar, BackgroundTransparency = 1, Position = UDim2.new(1, -34, 0, 0), Size = UDim2.new(0, 24, 1, 0), Font = Enum.Font.GothamBold, Text = "X", TextColor3 = theme.muted, TextSize = 14, }) local minBtn = make("TextButton", { Parent = topBar, BackgroundTransparency = 1, Position = UDim2.new(1, -62, 0, 0), Size = UDim2.new(0, 24, 1, 0), Font = Enum.Font.GothamBold, Text = "-", TextColor3 = theme.muted, TextSize = 18, }) -- dragging local dragging = false local dragStart, startPos topBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = main.Position end end) UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) -- body: tab column (left) + content (right) local body = make("Frame", { Parent = main, BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0, 40), Size = UDim2.new(1, 0, 1, -40), }) local tabColumn = make("ScrollingFrame", { Parent = body, BackgroundColor3 = theme.bgLight, BorderSizePixel = 0, Size = UDim2.new(0, 140, 1, 0), CanvasSize = UDim2.new(0, 0, 0, 0), ScrollBarThickness = 2, ScrollBarImageColor3 = theme.border, AutomaticCanvasSize = Enum.AutomaticSize.Y, }) local tabLayout = make("UIListLayout", { Parent = tabColumn, FillDirection = Enum.FillDirection.Vertical, Padding = UDim.new(0, 4), SortOrder = Enum.SortOrder.LayoutOrder, }) pad(tabColumn, 8, 8, 8, 8) local contentArea = make("Frame", { Parent = body, BackgroundTransparency = 1, Position = UDim2.new(0, 148, 0, 8), Size = UDim2.new(1, -156, 1, -16), }) local window = { _screen = screen, _theme = theme, _tabButtons = {} } local tabs = {} local currentFrame = nil local function selectTab(tab) for _, t in ipairs(tabs) do t.frame.Visible = (t == tab) local col = (t == tab) and window._theme.accent or window._theme.muted t.button.TextColor3 = col end currentFrame = tab.frame end -- Window:CreateTab("Name") -> Tab с элементами function window:CreateTab(tabName) local tab = { _name = tabName or "Tab" } local btn = make("TextButton", { Parent = tabColumn, BackgroundColor3 = theme.bgElement, BorderSizePixel = 0, Size = UDim2.new(1, 0, 0, 30), Font = Enum.Font.GothamBold, Text = tostring(tab._name), TextColor3 = theme.muted, TextSize = 13, AutoButtonColor = true, }) corner(btn, 8) tab.button = btn local content = make("ScrollingFrame", { Parent = contentArea, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 1, 0), CanvasSize = UDim2.new(0, 0, 0, 0), ScrollBarThickness = 3, ScrollBarImageColor3 = theme.accent, AutomaticCanvasSize = Enum.AutomaticSize.Y, Visible = false, BorderSizePixel = 0, }) make("UIListLayout", { Parent = content, Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder, }) tab.frame = content table.insert(tabs, tab) btn.MouseButton1Click:Connect(function() selectTab(tab) end) if #tabs == 1 then selectTab(tab) end -- Tab:CreateLabel("text") function tab:CreateLabel(text) local wrap = make("Frame", { Parent = content, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 18), }) return make_label(wrap, text, theme) end -- Tab:CreateSection("Title") function tab:CreateSection(name) local wrap = make("Frame", { Parent = content, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 22), }) local lbl = make_label(wrap, name, theme, 18) lbl.Font = Enum.Font.GothamBold lbl.TextColor3 = theme.accent return lbl end -- Tab:CreateButton({ Title = "...", Callback = function() end }) function tab:CreateButton(cfg) cfg = cfg or {} local f = make_element_frame(content, theme, 38) local lbl = make("TextLabel", { Parent = f, BackgroundTransparency = 1, Position = UDim2.new(0, 12, 0, 0), Size = UDim2.new(1, -24, 1, 0), Font = Enum.Font.Gotham, Text = tostring(cfg.Title or "Button"), TextColor3 = theme.text, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) local handle = { _frame = f } f.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then if type(cfg.Callback) == "function" then task.spawn(cfg.Callback) end end end) function handle:SetTitle(t) lbl.Text = tostring(t) end return handle end -- Tab:CreateToggle({ Title = "...", Default = false, -- Callback = function(state) end }) function tab:CreateToggle(cfg) cfg = cfg or {} local state = cfg.Default and true or false local f = make_element_frame(content, theme, 38) local lbl = make("TextLabel", { Parent = f, BackgroundTransparency = 1, Position = UDim2.new(0, 12, 0, 0), Size = UDim2.new(1, -80, 1, 0), Font = Enum.Font.Gotham, Text = tostring(cfg.Title or "Toggle"), TextColor3 = theme.text, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) local pill = make("Frame", { Parent = f, BackgroundColor3 = state and theme.accent or theme.border, BorderSizePixel = 0, Position = UDim2.new(1, -56, 0.5, -10), Size = UDim2.new(0, 44, 0, 20), }) corner(pill, 10) local knob = make("Frame", { Parent = pill, BackgroundColor3 = Color3.fromRGB(255, 255, 255), BorderSizePixel = 0, Position = state and UDim2.new(1, -18, 0, 2) or UDim2.new(0, 2, 0, 2), Size = UDim2.new(0, 16, 0, 16), }) corner(knob, 8) local handle = { _frame = f, State = state } local function render() pill.BackgroundColor3 = handle.State and theme.accent or theme.border knob.Position = handle.State and UDim2.new(1, -18, 0, 2) or UDim2.new(0, 2, 0, 2) end local function click() handle.State = not handle.State render() if type(cfg.Callback) == "function" then task.spawn(cfg.Callback, handle.State) end end pill.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then click() end end) lbl.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then click() end end) function handle:Set(state) handle.State = state and true or false render() end return handle end -- Tab:CreateSlider({ Title = "...", Min = 0, Max = 100, Default = 50, -- Callback = function(value) end }) function tab:CreateSlider(cfg) cfg = cfg or {} local minV = tonumber(cfg.Min) or 0 local maxV = tonumber(cfg.Max) or 100 local value = tonumber(cfg.Default) or minV local f = make_element_frame(content, theme, 52) local lbl = make("TextLabel", { Parent = f, BackgroundTransparency = 1, Position = UDim2.new(0, 12, 0, 6), Size = UDim2.new(1, -24, 0, 14), Font = Enum.Font.Gotham, Text = tostring(cfg.Title or "Slider"), TextColor3 = theme.text, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) local valueLbl = make("TextLabel", { Parent = f, BackgroundTransparency = 1, Position = UDim2.new(0, 12, 0, 6), Size = UDim2.new(1, -24, 0, 14), Font = Enum.Font.GothamBold, Text = tostring(value), TextColor3 = theme.accent, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Right, }) local bar = make("Frame", { Parent = f, BackgroundColor3 = theme.border, BorderSizePixel = 0, Position = UDim2.new(0, 12, 0, 32), Size = UDim2.new(1, -24, 0, 8), }) corner(bar, 4) local fill = make("Frame", { Parent = bar, BackgroundColor3 = theme.accent, BorderSizePixel = 0, Size = UDim2.new(math.clamp((value - minV) / (maxV - minV), 0, 1), 0, 1, 0), }) corner(fill, 4) local handle = { _frame = f, Value = value } local function setFromX(x) local rel = 0 if bar.AbsoluteSize.X > 0 then rel = (x - bar.AbsolutePosition.X) / bar.AbsoluteSize.X end rel = math.clamp(rel, 0, 1) handle.Value = math.floor(minV + (maxV - minV) * rel + 0.5) fill.Size = UDim2.new(rel, 0, 1, 0) valueLbl.Text = tostring(handle.Value) if type(cfg.Callback) == "function" then task.spawn(cfg.Callback, handle.Value) end end local pressing = false bar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then pressing = true setFromX(input.Position.X) end end) UserInputService.InputChanged:Connect(function(input) if pressing and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then setFromX(input.Position.X) end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then pressing = false end end) function handle:Set(v) v = math.clamp(tonumber(v) or minV, minV, maxV) setFromX(bar.AbsolutePosition.X + bar.AbsoluteSize.X * (v - minV) / (maxV - minV)) end return handle end -- Tab:CreateDropdown({ Title = "...", Options = {"a","b"}, -- Callback = function(option) end }) function tab:CreateDropdown(cfg) cfg = cfg or {} local options = cfg.Options or {} local selected = cfg.Default or (options[1] or "Select...") local open = false local f = make_element_frame(content, theme, 38) local lbl = make("TextLabel", { Parent = f, BackgroundTransparency = 1, Position = UDim2.new(0, 12, 0, 0), Size = UDim2.new(0.5, -12, 1, 0), Font = Enum.Font.Gotham, Text = tostring(cfg.Title or "Dropdown"), TextColor3 = theme.text, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) local selBtn = make("TextButton", { Parent = f, BackgroundColor3 = theme.bgLight, BorderSizePixel = 0, Position = UDim2.new(1, -170, 0, 5), Size = UDim2.new(0, 160, 0, 28), Font = Enum.Font.Gotham, Text = tostring(selected), TextColor3 = theme.accent, TextSize = 12, TextTruncate = Enum.TextTruncate.AtEnd, }) corner(selBtn, 6) local listFrame = make("Frame", { Parent = f, BackgroundColor3 = theme.bgLight, BorderSizePixel = 0, Position = UDim2.new(1, -170, 0, 36), Size = UDim2.new(0, 160, 0, 0), Visible = false, ZIndex = 5, }) corner(listFrame, 6) local listLayout = make("UIListLayout", { Parent = listFrame, Padding = UDim.new(0, 2), SortOrder = Enum.SortOrder.LayoutOrder, }) local handle = { _frame = f, Option = selected } local function rebuildList() for _, child in ipairs(listFrame:GetChildren()) do if child:IsA("TextButton") then child:Destroy() end end local height = 4 for _, opt in ipairs(options) do local optBtn = make("TextButton", { Parent = listFrame, BackgroundColor3 = theme.bgElement, BorderSizePixel = 0, Size = UDim2.new(1, -6, 0, 24), Position = UDim2.new(0, 3, 0, height), Font = Enum.Font.Gotham, Text = tostring(opt), TextColor3 = theme.text, TextSize = 12, ZIndex = 6, }) corner(optBtn, 4) height = height + 26 optBtn.MouseButton1Click:Connect(function() handle.Option = opt selBtn.Text = tostring(opt) open = false listFrame.Visible = false f.Size = UDim2.new(1, 0, 0, 38) if type(cfg.Callback) == "function" then task.spawn(cfg.Callback, opt) end end) end listFrame.Size = UDim2.new(0, 160, 0, height) end rebuildList() selBtn.MouseButton1Click:Connect(function() open = not open if open then rebuildList() end listFrame.Visible = open f.Size = UDim2.new(1, 0, 0, open and (44 + listFrame.Size.Y.Offset) or 38) end) function handle:SetOptions(opts) options = opts or {} rebuildList() end return handle end -- Tab:CreateInput({ Title = "...", Placeholder = "...", -- Callback = function(text) end }) function tab:CreateInput(cfg) cfg = cfg or {} local f = make_element_frame(content, theme, 42) local lbl = make("TextLabel", { Parent = f, BackgroundTransparency = 1, Position = UDim2.new(0, 12, 0, 0), Size = UDim2.new(0.4, -12, 1, 0), Font = Enum.Font.Gotham, Text = tostring(cfg.Title or "Input"), TextColor3 = theme.text, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }) local box = make("TextBox", { Parent = f, BackgroundColor3 = theme.bgLight, BorderSizePixel = 0, Position = UDim2.new(0.4, 0, 0, 6), Size = UDim2.new(0.6, -20, 0, 30), Font = Enum.Font.Gotham, PlaceholderText = tostring(cfg.Placeholder or "..."), Text = "", TextColor3 = theme.text, TextSize = 13, ClearTextOnFocus = false, }) corner(box, 6) pad(box, 8, 0, 8, 0) local handle = { _frame = f, _box = box } box.FocusLost:Connect(function(enterPressed) if enterPressed and type(cfg.Callback) == "function" then task.spawn(cfg.Callback, box.Text) end end) function handle:Get() return box.Text end function handle:Set(text) box.Text = tostring(text) end return handle end return tab end minBtn.MouseButton1Click:Connect(function() main.Visible = not main.Visible end) closeBtn.MouseButton1Click:Connect(function() screen:Destroy() end) -- Window:Destroy() — полностью убрать GUI function window:Destroy() screen:Destroy() end -- Window:SetTitle("new title") function window:SetTitle(text) titleLabel.Text = tostring(text) end -- Window:SetAccent(Color3) — сменить акцент на лету function window:SetAccent(color) theme.accent = color titleLabel.TextColor3 = color for _, t in ipairs(tabs) do t.frame.ScrollBarImageColor3 = color end end return window end return GHUI