King12255

KMX

Aug 27th, 2025 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.76 KB | None | 0 0
  1. --// KMX UI Library
  2. local TweenService = game:GetService("TweenService")
  3. local UserInputService = game:GetService("UserInputService")
  4.  
  5. local KMX = {}
  6. KMX.__index = KMX
  7.  
  8. -- // Create Window
  9. function KMX:CreateWindow(config)
  10.     local Window = Instance.new("ScreenGui")
  11.     Window.Name = config.Name or "KMX_UI"
  12.     Window.Parent = game.CoreGui
  13.     Window.ResetOnSpawn = false
  14.  
  15.     local Main = Instance.new("Frame")
  16.     Main.Size = UDim2.new(0, 500, 0, 300)
  17.     Main.Position = UDim2.new(0.5, -250, 0.5, -150)
  18.     Main.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
  19.     Main.BorderSizePixel = 0
  20.     Main.Active = true
  21.     Main.Draggable = true
  22.     Main.Parent = Window
  23.  
  24.     local UICorner = Instance.new("UICorner", Main)
  25.     UICorner.CornerRadius = UDim.new(0, 12)
  26.  
  27.     local UIStroke = Instance.new("UIStroke", Main)
  28.     UIStroke.Color = Color3.fromRGB(100, 100, 255)
  29.     UIStroke.Thickness = 2
  30.  
  31.     local Title = Instance.new("TextLabel")
  32.     Title.Size = UDim2.new(1, 0, 0, 40)
  33.     Title.BackgroundTransparency = 1
  34.     Title.Text = config.Title or "KMX UI"
  35.     Title.Font = Enum.Font.GothamBold
  36.     Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  37.     Title.TextSize = 20
  38.     Title.Parent = Main
  39.  
  40.     local TabHolder = Instance.new("Frame")
  41.     TabHolder.Size = UDim2.new(0, 120, 1, -40)
  42.     TabHolder.Position = UDim2.new(0, 0, 0, 40)
  43.     TabHolder.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  44.     TabHolder.BorderSizePixel = 0
  45.     TabHolder.Parent = Main
  46.  
  47.     local UICorner2 = Instance.new("UICorner", TabHolder)
  48.     UICorner2.CornerRadius = UDim.new(0, 8)
  49.  
  50.     local TabContainer = Instance.new("Frame")
  51.     TabContainer.Size = UDim2.new(1, -120, 1, -40)
  52.     TabContainer.Position = UDim2.new(0, 120, 0, 40)
  53.     TabContainer.BackgroundTransparency = 1
  54.     TabContainer.Parent = Main
  55.  
  56.     local UI = {
  57.         Window = Window,
  58.         Main = Main,
  59.         TabHolder = TabHolder,
  60.         TabContainer = TabContainer,
  61.         Tabs = {}
  62.     }
  63.  
  64.     setmetatable(UI, self)
  65.     return UI
  66. end
  67.  
  68. -- // Add Tab
  69. function KMX:AddTab(tabName)
  70.     local Button = Instance.new("TextButton")
  71.     Button.Size = UDim2.new(1, 0, 0, 35)
  72.     Button.Text = tabName
  73.     Button.Font = Enum.Font.Gotham
  74.     Button.TextSize = 16
  75.     Button.TextColor3 = Color3.fromRGB(200, 200, 200)
  76.     Button.BackgroundTransparency = 1
  77.     Button.Parent = self.TabHolder
  78.  
  79.     local Page = Instance.new("ScrollingFrame")
  80.     Page.Size = UDim2.new(1, 0, 1, 0)
  81.     Page.BackgroundTransparency = 1
  82.     Page.Visible = false
  83.     Page.CanvasSize = UDim2.new(0, 0, 0, 0)
  84.     Page.ScrollBarThickness = 4
  85.     Page.Parent = self.TabContainer
  86.  
  87.     self.Tabs[tabName] = Page
  88.  
  89.     Button.MouseButton1Click:Connect(function()
  90.         for _, v in pairs(self.TabContainer:GetChildren()) do
  91.             if v:IsA("ScrollingFrame") then v.Visible = false end
  92.         end
  93.         Page.Visible = true
  94.     end)
  95.  
  96.     return Page
  97. end
  98.  
  99. -- // Add Button
  100. function KMX:AddButton(tab, text, callback)
  101.     local Btn = Instance.new("TextButton")
  102.     Btn.Size = UDim2.new(0, 300, 0, 40)
  103.     Btn.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  104.     Btn.Text = text
  105.     Btn.Font = Enum.Font.Gotham
  106.     Btn.TextSize = 16
  107.     Btn.TextColor3 = Color3.fromRGB(255, 255, 255)
  108.     Btn.Parent = tab
  109.  
  110.     local UICorner = Instance.new("UICorner", Btn)
  111.     UICorner.CornerRadius = UDim.new(0, 8)
  112.  
  113.     Btn.MouseButton1Click:Connect(function()
  114.         TweenService:Create(Btn, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  115.         task.wait(0.2)
  116.         TweenService:Create(Btn, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(35, 35, 35)}):Play()
  117.         if callback then callback() end
  118.     end)
  119. end
  120.  
  121. -- More (Toggle, Slider, TextBox, NumBox) can be added the same way
  122. return KMX
Advertisement
Add Comment
Please, Sign In to add comment