Advertisement
SLEEZESE

UI Lib

Apr 9th, 2025 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | Gaming | 0 0
  1. local uiLibraryCode = [[
  2.     local UI = {}
  3.  
  4.     function UI:CreateWindow(title)
  5.         local ScreenGui = Instance.new("ScreenGui")
  6.         local Frame = Instance.new("Frame")
  7.         local TitleLabel = Instance.new("TextLabel")
  8.  
  9.         ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  10.  
  11.         Frame.Parent = ScreenGui
  12.         Frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  13.         Frame.Size = UDim2.new(0, 300, 0, 200)
  14.         Frame.Position = UDim2.new(0.5, -150, 0.5, -100)
  15.         Frame.AnchorPoint = Vector2.new(0.5, 0.5)
  16.  
  17.         TitleLabel.Parent = Frame
  18.         TitleLabel.BackgroundTransparency = 1
  19.         TitleLabel.Size = UDim2.new(1, 0, 0, 50)
  20.         TitleLabel.Text = title
  21.         TitleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  22.         TitleLabel.TextScaled = true
  23.         TitleLabel.TextStrokeTransparency = 0.5
  24.  
  25.         return Frame
  26.     end
  27.  
  28.     function UI:CreateButton(parent, text, callback)
  29.         local Button = Instance.new("TextButton")
  30.        
  31.         Button.Parent = parent
  32.         Button.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  33.         Button.Size = UDim2.new(0, 200, 0, 50)
  34.         Button.Text = text
  35.         Button.TextColor3 = Color3.fromRGB(255, 255, 255)
  36.         Button.TextScaled = true
  37.  
  38.         -- Mengatur posisi tombol secara otomatis
  39.         local buttonCount = #parent:GetChildren() - 1 -- Menghitung jumlah tombol yang ada
  40.         Button.Position = UDim2.new(0.5, -100, 0.5, (buttonCount * 60) - 25) -- Mengatur posisi berdasarkan jumlah tombol
  41.  
  42.         Button.MouseButton1Click:Connect(callback)
  43.  
  44.         return Button
  45.     end
  46.  
  47.     return UI
  48. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement