Advertisement
PC55654

Templete

Apr 30th, 2025 (edited)
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.12 KB | Source Code | 0 0
  1. --test1
  2. local AdminLib = {}
  3. AdminLib.__index = AdminLib
  4.  
  5. -- Create the main GUI
  6. function AdminLib:New(title)
  7.     local ScreenGui = Instance.new("ScreenGui")
  8.     ScreenGui.Name = "AdminGUI"
  9.     ScreenGui.ResetOnSpawn = false
  10.     ScreenGui.Parent = game:GetService("CoreGui")
  11.  
  12.     local MainFrame = Instance.new("Frame")
  13.     MainFrame.Name = "MainFrame"
  14.     MainFrame.Size = UDim2.new(0, 460, 0, 360)
  15.     MainFrame.Position = UDim2.new(0.5, -230, 0.5, -180)
  16.     MainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  17.     MainFrame.BorderSizePixel = 0
  18.     MainFrame.Active = true
  19.     MainFrame.Draggable = true
  20.     MainFrame.Parent = ScreenGui
  21.  
  22.     local Title = Instance.new("TextLabel")
  23.     Title.Text = title or "Admin GUI"
  24.     Title.Size = UDim2.new(1, 0, 0, 40)
  25.     Title.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  26.     Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  27.     Title.Font = Enum.Font.GothamBold
  28.     Title.TextSize = 20
  29.     Title.Parent = MainFrame
  30.  
  31.     local TabBar = Instance.new("ScrollingFrame")
  32.     TabBar.Name = "TabBar"
  33.     TabBar.Size = UDim2.new(1, 0, 0, 30)
  34.     TabBar.Position = UDim2.new(0, 0, 0, 40)
  35.     TabBar.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
  36.     TabBar.ScrollBarThickness = 4
  37.     TabBar.CanvasSize = UDim2.new(10, 0, 0, 30)
  38.     TabBar.AutomaticCanvasSize = Enum.AutomaticSize.X
  39.     TabBar.ScrollingDirection = Enum.ScrollingDirection.X
  40.     TabBar.Parent = MainFrame
  41.  
  42.     local TabLayout = Instance.new("UIListLayout", TabBar)
  43.     TabLayout.FillDirection = Enum.FillDirection.Horizontal
  44.     TabLayout.SortOrder = Enum.SortOrder.LayoutOrder
  45.     TabLayout.Padding = UDim.new(0, 5)
  46.  
  47.     local TabHolder = Instance.new("Frame")
  48.     TabHolder.Name = "Tabs"
  49.     TabHolder.Size = UDim2.new(1, 0, 1, -70)
  50.     TabHolder.Position = UDim2.new(0, 0, 0, 70)
  51.     TabHolder.BackgroundTransparency = 1
  52.     TabHolder.Parent = MainFrame
  53.  
  54.     local lib = setmetatable({
  55.         GUI = ScreenGui,
  56.         MainFrame = MainFrame,
  57.         TabBar = TabBar,
  58.         TabHolder = TabHolder,
  59.         Tabs = {}
  60.     }, AdminLib)
  61.  
  62.     return lib
  63. end
  64.  
  65. function AdminLib:Tab(name)
  66.     local TabButton = Instance.new("TextButton")
  67.     TabButton.Size = UDim2.new(0, 100, 1, 0)
  68.     TabButton.Text = name
  69.     TabButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  70.     TabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  71.     TabButton.Font = Enum.Font.Gotham
  72.     TabButton.TextSize = 14
  73.     TabButton.Parent = self.TabBar
  74.  
  75.     local TabFrame = Instance.new("ScrollingFrame")
  76.     TabFrame.Size = UDim2.new(1, 0, 1, 0)
  77.     TabFrame.BackgroundTransparency = 1
  78.     TabFrame.Visible = true
  79.     TabFrame.CanvasSize = UDim2.new(0, 0, 10, 0)
  80.     TabFrame.ScrollBarThickness = 4
  81.     TabFrame.Parent = self.TabHolder
  82.  
  83.     local layout = Instance.new("UIListLayout", TabFrame)
  84.     layout.Padding = UDim.new(0, 6)
  85.     layout.SortOrder = Enum.SortOrder.LayoutOrder
  86.  
  87.     local tab = {
  88.         Frame = TabFrame,
  89.         Button = TabButton
  90.     }
  91.  
  92.     function tab:Toggle(text, default, callback)
  93.         local toggled = default or false
  94.         local btn = Instance.new("TextButton")
  95.         btn.Size = UDim2.new(0, 400, 0, 36)
  96.         btn.BackgroundColor3 = toggled and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(200, 0, 0)
  97.         btn.Text = text .. (toggled and " (On)" or " (Off)")
  98.         btn.TextColor3 = Color3.fromRGB(255, 255, 255)
  99.         btn.Font = Enum.Font.Gotham
  100.         btn.TextSize = 16
  101.         btn.Parent = TabFrame
  102.  
  103.         btn.MouseButton1Click:Connect(function()
  104.             toggled = not toggled
  105.             btn.BackgroundColor3 = toggled and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(200, 0, 0)
  106.             btn.Text = text .. (toggled and " (On)" or " (Off)")
  107.             if callback then pcall(callback, toggled) end
  108.         end)
  109.     end
  110.  
  111.     function tab:Slider(label, min, max, default, callback)
  112.         local frame = Instance.new("Frame")
  113.         frame.Size = UDim2.new(0, 400, 0, 50)
  114.         frame.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  115.         frame.Parent = TabFrame
  116.  
  117.         local lbl = Instance.new("TextLabel")
  118.         lbl.Size = UDim2.new(1, 0, 0, 20)
  119.         lbl.Text = label .. ": " .. tostring(default)
  120.         lbl.TextColor3 = Color3.fromRGB(255, 255, 255)
  121.         lbl.BackgroundTransparency = 1
  122.         lbl.Font = Enum.Font.Gotham
  123.         lbl.TextSize = 14
  124.         lbl.Parent = frame
  125.  
  126.         local slider = Instance.new("TextButton")
  127.         slider.Size = UDim2.new(1, -10, 0, 20)
  128.         slider.Position = UDim2.new(0, 5, 0, 25)
  129.         slider.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  130.         slider.Text = ""
  131.         slider.AutoButtonColor = false
  132.         slider.Parent = frame
  133.  
  134.         local value = default
  135.  
  136.         slider.MouseButton1Down:Connect(function()
  137.             local con
  138.             con = game:GetService("UserInputService").InputChanged:Connect(function(input)
  139.                 if input.UserInputType == Enum.UserInputType.MouseMovement then
  140.                     local rel = (input.Position.X - slider.AbsolutePosition.X) / slider.AbsoluteSize.X
  141.                     rel = math.clamp(rel, 0, 1)
  142.                     value = math.floor((rel * (max - min)) + min)
  143.                     lbl.Text = label .. ": " .. value
  144.                     if callback then pcall(callback, value) end
  145.                 end
  146.             end)
  147.             game:GetService("UserInputService").InputEnded:Connect(function(input)
  148.                 if input.UserInputType == Enum.UserInputType.MouseButton1 then
  149.                     con:Disconnect()
  150.                 end
  151.             end)
  152.         end)
  153.     end
  154.  
  155.     TabButton.MouseButton1Click:Connect(function()
  156.         for _, t in pairs(self.Tabs) do
  157.             t.Frame.Visible = false
  158.         end
  159.         TabFrame.Visible = true
  160.     end)
  161.  
  162.     table.insert(self.Tabs, tab)
  163.     return tab
  164. end
  165.  
  166. return AdminLib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement