Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --test1
- local AdminLib = {}
- AdminLib.__index = AdminLib
- -- Create the main GUI
- function AdminLib:New(title)
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Name = "AdminGUI"
- ScreenGui.ResetOnSpawn = false
- ScreenGui.Parent = game:GetService("CoreGui")
- local MainFrame = Instance.new("Frame")
- MainFrame.Name = "MainFrame"
- MainFrame.Size = UDim2.new(0, 460, 0, 360)
- MainFrame.Position = UDim2.new(0.5, -230, 0.5, -180)
- MainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- MainFrame.BorderSizePixel = 0
- MainFrame.Active = true
- MainFrame.Draggable = true
- MainFrame.Parent = ScreenGui
- local Title = Instance.new("TextLabel")
- Title.Text = title or "Admin GUI"
- Title.Size = UDim2.new(1, 0, 0, 40)
- Title.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- Title.TextColor3 = Color3.fromRGB(255, 255, 255)
- Title.Font = Enum.Font.GothamBold
- Title.TextSize = 20
- Title.Parent = MainFrame
- local TabBar = Instance.new("ScrollingFrame")
- TabBar.Name = "TabBar"
- TabBar.Size = UDim2.new(1, 0, 0, 30)
- TabBar.Position = UDim2.new(0, 0, 0, 40)
- TabBar.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
- TabBar.ScrollBarThickness = 4
- TabBar.CanvasSize = UDim2.new(10, 0, 0, 30)
- TabBar.AutomaticCanvasSize = Enum.AutomaticSize.X
- TabBar.ScrollingDirection = Enum.ScrollingDirection.X
- TabBar.Parent = MainFrame
- local TabLayout = Instance.new("UIListLayout", TabBar)
- TabLayout.FillDirection = Enum.FillDirection.Horizontal
- TabLayout.SortOrder = Enum.SortOrder.LayoutOrder
- TabLayout.Padding = UDim.new(0, 5)
- local TabHolder = Instance.new("Frame")
- TabHolder.Name = "Tabs"
- TabHolder.Size = UDim2.new(1, 0, 1, -70)
- TabHolder.Position = UDim2.new(0, 0, 0, 70)
- TabHolder.BackgroundTransparency = 1
- TabHolder.Parent = MainFrame
- local lib = setmetatable({
- GUI = ScreenGui,
- MainFrame = MainFrame,
- TabBar = TabBar,
- TabHolder = TabHolder,
- Tabs = {}
- }, AdminLib)
- return lib
- end
- function AdminLib:Tab(name)
- local TabButton = Instance.new("TextButton")
- TabButton.Size = UDim2.new(0, 100, 1, 0)
- TabButton.Text = name
- TabButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- TabButton.Font = Enum.Font.Gotham
- TabButton.TextSize = 14
- TabButton.Parent = self.TabBar
- local TabFrame = Instance.new("ScrollingFrame")
- TabFrame.Size = UDim2.new(1, 0, 1, 0)
- TabFrame.BackgroundTransparency = 1
- TabFrame.Visible = true
- TabFrame.CanvasSize = UDim2.new(0, 0, 10, 0)
- TabFrame.ScrollBarThickness = 4
- TabFrame.Parent = self.TabHolder
- local layout = Instance.new("UIListLayout", TabFrame)
- layout.Padding = UDim.new(0, 6)
- layout.SortOrder = Enum.SortOrder.LayoutOrder
- local tab = {
- Frame = TabFrame,
- Button = TabButton
- }
- function tab:Toggle(text, default, callback)
- local toggled = default or false
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.new(0, 400, 0, 36)
- btn.BackgroundColor3 = toggled and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(200, 0, 0)
- btn.Text = text .. (toggled and " (On)" or " (Off)")
- btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- btn.Font = Enum.Font.Gotham
- btn.TextSize = 16
- btn.Parent = TabFrame
- btn.MouseButton1Click:Connect(function()
- toggled = not toggled
- btn.BackgroundColor3 = toggled and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(200, 0, 0)
- btn.Text = text .. (toggled and " (On)" or " (Off)")
- if callback then pcall(callback, toggled) end
- end)
- end
- function tab:Slider(label, min, max, default, callback)
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 400, 0, 50)
- frame.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- frame.Parent = TabFrame
- local lbl = Instance.new("TextLabel")
- lbl.Size = UDim2.new(1, 0, 0, 20)
- lbl.Text = label .. ": " .. tostring(default)
- lbl.TextColor3 = Color3.fromRGB(255, 255, 255)
- lbl.BackgroundTransparency = 1
- lbl.Font = Enum.Font.Gotham
- lbl.TextSize = 14
- lbl.Parent = frame
- local slider = Instance.new("TextButton")
- slider.Size = UDim2.new(1, -10, 0, 20)
- slider.Position = UDim2.new(0, 5, 0, 25)
- slider.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- slider.Text = ""
- slider.AutoButtonColor = false
- slider.Parent = frame
- local value = default
- slider.MouseButton1Down:Connect(function()
- local con
- con = game:GetService("UserInputService").InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- local rel = (input.Position.X - slider.AbsolutePosition.X) / slider.AbsoluteSize.X
- rel = math.clamp(rel, 0, 1)
- value = math.floor((rel * (max - min)) + min)
- lbl.Text = label .. ": " .. value
- if callback then pcall(callback, value) end
- end
- end)
- game:GetService("UserInputService").InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- con:Disconnect()
- end
- end)
- end)
- end
- TabButton.MouseButton1Click:Connect(function()
- for _, t in pairs(self.Tabs) do
- t.Frame.Visible = false
- end
- TabFrame.Visible = true
- end)
- table.insert(self.Tabs, tab)
- return tab
- end
- return AdminLib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement