Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Библиотека с кнопками
- local libraryHub = {}
- -- Функция для создания кнопки
- function libraryHub:CreateButton(name, callback)
- -- Создаем кнопку
- local button = Instance.new("TextButton")
- button.Name = name
- button.Text = name
- button.Size = UDim2.new(0, 419, 0, 36)
- button.BackgroundColor3 = Color3.fromRGB(170, 0, 255)
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.TextSize = 20
- button.TextXAlignment = Enum.TextXAlignment.Left
- button.Font = Enum.Font.SourceSansBold
- -- Закругляем углы
- local UICornerButton = Instance.new("UICorner")
- UICornerButton.Parent = button
- -- Выполняем скрипт по нажатию на кнопку
- button.MouseButton1Click:Connect(function()
- if callback then
- callback()
- end
- end)
- -- Добавляем кнопку в ScrollingFrame
- button.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("ScrollingFrame")
- end
- -- Создаем меню с кнопками
- function libraryHub:CreateMenu()
- -- Создаем ScrollingFrame для кнопок
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local scrollingFrame = Instance.new("ScrollingFrame")
- scrollingFrame.Parent = screenGui
- scrollingFrame.Size = UDim2.new(0, 450, 0, 400)
- scrollingFrame.Position = UDim2.new(0.5, -225, 0.5, -200)
- scrollingFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- scrollingFrame.ScrollBarThickness = 10
- -- UIListLayout для кнопок
- local listLayout = Instance.new("UIListLayout")
- listLayout.Parent = scrollingFrame
- listLayout.Padding = UDim.new(0, 10)
- -- Добавление кнопок
- self:CreateButton("Button 1", function()
- print("Button 1 pressed")
- end)
- self:CreateButton("Button 2", function()
- print("Button 2 pressed")
- end)
- end
- return libraryHub
Advertisement
Add Comment
Please, Sign In to add comment