Kotyara19k-Official

Untitled

Apr 4th, 2025
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. -- Библиотека с кнопками
  2. local libraryHub = {}
  3.  
  4. -- Функция для создания кнопки
  5. function libraryHub:CreateButton(name, callback)
  6. -- Создаем кнопку
  7. local button = Instance.new("TextButton")
  8. button.Name = name
  9. button.Text = name
  10. button.Size = UDim2.new(0, 419, 0, 36)
  11. button.BackgroundColor3 = Color3.fromRGB(170, 0, 255)
  12. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  13. button.TextSize = 20
  14. button.TextXAlignment = Enum.TextXAlignment.Left
  15. button.Font = Enum.Font.SourceSansBold
  16.  
  17. -- Закругляем углы
  18. local UICornerButton = Instance.new("UICorner")
  19. UICornerButton.Parent = button
  20.  
  21. -- Выполняем скрипт по нажатию на кнопку
  22. button.MouseButton1Click:Connect(function()
  23. if callback then
  24. callback()
  25. end
  26. end)
  27.  
  28. -- Добавляем кнопку в ScrollingFrame
  29. button.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("ScrollingFrame")
  30. end
  31.  
  32. -- Создаем меню с кнопками
  33. function libraryHub:CreateMenu()
  34. -- Создаем ScrollingFrame для кнопок
  35. local screenGui = Instance.new("ScreenGui")
  36. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  37.  
  38. local scrollingFrame = Instance.new("ScrollingFrame")
  39. scrollingFrame.Parent = screenGui
  40. scrollingFrame.Size = UDim2.new(0, 450, 0, 400)
  41. scrollingFrame.Position = UDim2.new(0.5, -225, 0.5, -200)
  42. scrollingFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  43. scrollingFrame.ScrollBarThickness = 10
  44.  
  45. -- UIListLayout для кнопок
  46. local listLayout = Instance.new("UIListLayout")
  47. listLayout.Parent = scrollingFrame
  48. listLayout.Padding = UDim.new(0, 10)
  49.  
  50. -- Добавление кнопок
  51. self:CreateButton("Button 1", function()
  52. print("Button 1 pressed")
  53. end)
  54.  
  55. self:CreateButton("Button 2", function()
  56. print("Button 2 pressed")
  57. end)
  58. end
  59.  
  60. return libraryHub
  61.  
Advertisement
Add Comment
Please, Sign In to add comment