Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// KMX UI Library
- local TweenService = game:GetService("TweenService")
- local UserInputService = game:GetService("UserInputService")
- local KMX = {}
- KMX.__index = KMX
- -- // Create Window
- function KMX:CreateWindow(config)
- local Window = Instance.new("ScreenGui")
- Window.Name = config.Name or "KMX_UI"
- Window.Parent = game.CoreGui
- Window.ResetOnSpawn = false
- local Main = Instance.new("Frame")
- Main.Size = UDim2.new(0, 500, 0, 300)
- Main.Position = UDim2.new(0.5, -250, 0.5, -150)
- Main.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
- Main.BorderSizePixel = 0
- Main.Active = true
- Main.Draggable = true
- Main.Parent = Window
- local UICorner = Instance.new("UICorner", Main)
- UICorner.CornerRadius = UDim.new(0, 12)
- local UIStroke = Instance.new("UIStroke", Main)
- UIStroke.Color = Color3.fromRGB(100, 100, 255)
- UIStroke.Thickness = 2
- local Title = Instance.new("TextLabel")
- Title.Size = UDim2.new(1, 0, 0, 40)
- Title.BackgroundTransparency = 1
- Title.Text = config.Title or "KMX UI"
- Title.Font = Enum.Font.GothamBold
- Title.TextColor3 = Color3.fromRGB(255, 255, 255)
- Title.TextSize = 20
- Title.Parent = Main
- local TabHolder = Instance.new("Frame")
- TabHolder.Size = UDim2.new(0, 120, 1, -40)
- TabHolder.Position = UDim2.new(0, 0, 0, 40)
- TabHolder.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
- TabHolder.BorderSizePixel = 0
- TabHolder.Parent = Main
- local UICorner2 = Instance.new("UICorner", TabHolder)
- UICorner2.CornerRadius = UDim.new(0, 8)
- local TabContainer = Instance.new("Frame")
- TabContainer.Size = UDim2.new(1, -120, 1, -40)
- TabContainer.Position = UDim2.new(0, 120, 0, 40)
- TabContainer.BackgroundTransparency = 1
- TabContainer.Parent = Main
- local UI = {
- Window = Window,
- Main = Main,
- TabHolder = TabHolder,
- TabContainer = TabContainer,
- Tabs = {}
- }
- setmetatable(UI, self)
- return UI
- end
- -- // Add Tab
- function KMX:AddTab(tabName)
- local Button = Instance.new("TextButton")
- Button.Size = UDim2.new(1, 0, 0, 35)
- Button.Text = tabName
- Button.Font = Enum.Font.Gotham
- Button.TextSize = 16
- Button.TextColor3 = Color3.fromRGB(200, 200, 200)
- Button.BackgroundTransparency = 1
- Button.Parent = self.TabHolder
- local Page = Instance.new("ScrollingFrame")
- Page.Size = UDim2.new(1, 0, 1, 0)
- Page.BackgroundTransparency = 1
- Page.Visible = false
- Page.CanvasSize = UDim2.new(0, 0, 0, 0)
- Page.ScrollBarThickness = 4
- Page.Parent = self.TabContainer
- self.Tabs[tabName] = Page
- Button.MouseButton1Click:Connect(function()
- for _, v in pairs(self.TabContainer:GetChildren()) do
- if v:IsA("ScrollingFrame") then v.Visible = false end
- end
- Page.Visible = true
- end)
- return Page
- end
- -- // Add Button
- function KMX:AddButton(tab, text, callback)
- local Btn = Instance.new("TextButton")
- Btn.Size = UDim2.new(0, 300, 0, 40)
- Btn.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
- Btn.Text = text
- Btn.Font = Enum.Font.Gotham
- Btn.TextSize = 16
- Btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- Btn.Parent = tab
- local UICorner = Instance.new("UICorner", Btn)
- UICorner.CornerRadius = UDim.new(0, 8)
- Btn.MouseButton1Click:Connect(function()
- TweenService:Create(Btn, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(60, 60, 60)}):Play()
- task.wait(0.2)
- TweenService:Create(Btn, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(35, 35, 35)}):Play()
- if callback then callback() end
- end)
- end
- -- More (Toggle, Slider, TextBox, NumBox) can be added the same way
- return KMX
Advertisement
Add Comment
Please, Sign In to add comment