Untitled

 avatar
unknown
plain_text
6 months ago
1.8 kB
5
Indexable
-- UI Library
local UILibrary = {}

function UILibrary:CreateFrame(name, position, size)
    local frame = Instance.new("Frame")
    frame.Name = name
    frame.Position = position
    frame.Size = size
    frame.BackgroundColor3 = Color3.fromRGB(46, 46, 47)
    frame.BorderSizePixel = 0
    return frame
end

function UILibrary:CreateTextLabel(parent, text, position, size)
    local label = Instance.new("TextLabel")
    label.Parent = parent
    label.Text = text
    label.Position = position
    label.Size = size
    label.BackgroundTransparency = 1
    label.TextColor3 = Color3.new(1, 1, 1)
    label.Font = Enum.Font.SourceSans
    label.TextSize = 18
    return label
end

function UILibrary:CreateButton(parent, text, position, size, callback)
    local button = Instance.new("TextButton")
    button.Parent = parent
    button.Text = text
    button.Position = position
    button.Size = size
    button.BackgroundColor3 = Color3.fromRGB(78, 78, 79)
    button.TextColor3 = Color3.new(1, 1, 1)
    button.Font = Enum.Font.SourceSans
    button.TextSize = 14

    button.MouseButton1Click:Connect(callback)

    return button
end

function UILibrary:CreateCommandBar(parent)
    local cmdBar = UILibrary:CreateFrame("CmdBar", UDim2.new(0.5, -125, 0, 0), UDim2.new(0, 250, 0, 50))
    cmdBar.Parent = parent

    UILibrary:CreateTextLabel(cmdBar, "Command Bar", UDim2.new(0, 5, 0, 5), UDim2.new(1, -10, 0, 25))
    
    local inputBox = Instance.new("TextBox")
    inputBox.Parent = cmdBar
    inputBox.Position = UDim2.new(0, 5, 0, 30)
    inputBox.Size = UDim2.new(1, -10, 0, 25)
    inputBox.BackgroundColor3 = Color3.fromRGB(78, 78, 79)
    inputBox.TextColor3 = Color3.new(1, 1, 1)
    inputBox.PlaceholderText = "Type your command here..."
    
    return cmdBar
end

return UILibrary
Editor is loading...
Leave a Comment