Ameno__GodOH

ai

Oct 25th, 2024 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. local Library = {}
  2.  
  3. local TweenService = game:GetService("TweenService")
  4. local CoreGui = game:GetService("CoreGui")
  5.  
  6. local ScreenGui = Instance.new("ScreenGui", CoreGui)
  7. ScreenGui.IgnoreGuiInset = true
  8.  
  9. local Border = Instance.new("Frame", ScreenGui) do
  10. Border.Size = UDim2.new(0, 48, 0, 48)
  11. Border.Position = UDim2.new(0, 280, 0, 4)
  12. Border.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  13. Border.BackgroundTransparency = 0.3
  14. Border.ClipsDescendants = true
  15. Border.Active = true
  16.  
  17. local OpenClose = Instance.new("ImageButton", Border)
  18. OpenClose.Size = UDim2.new(0, 40, 0, 40)
  19. OpenClose.Position = UDim2.new(0, 4, 0.5, 0)
  20. OpenClose.AnchorPoint = Vector2.new(0, 0.5)
  21. OpenClose.Image = "rbxassetid://115839646734512"
  22. OpenClose.BackgroundTransparency = 1
  23.  
  24. local Corner = Instance.new("UICorner", OpenClose)
  25. Corner.CornerRadius = UDim.new(1, 0)
  26. Corner:Clone().Parent = Border
  27.  
  28. OpenClose.Activated:Connect(function()
  29. if Border:GetAttribute("Opened") then
  30. Border:SetAttribute("Opened", false)
  31.  
  32. OpenClose.BackgroundTransparency = 1
  33. Border:TweenSize(UDim2.new(0, 48, 0, 48), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.5, true)
  34. else
  35. Border:SetAttribute("Opened", true)
  36.  
  37. local NewSize = UDim2.new(0, Library:GetButtonsSize() + 48, 0, 48)
  38. OpenClose.BackgroundTransparency = 0.8
  39. Border:TweenSize(NewSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.5, true)
  40. end
  41. end)
  42. end
  43.  
  44. local Container = Instance.new("CanvasGroup", Border) do
  45. Container.Size = UDim2.new(1, -48, 1, 0)
  46. Container.Position = UDim2.new(0, 48, 0, 0)
  47. Container.BorderSizePixel = 0
  48. Container.BackgroundTransparency = 1
  49.  
  50. local Layout = Instance.new("UIListLayout", Container)
  51. Layout.VerticalAlignment = Enum.VerticalAlignment.Center
  52. Layout.FillDirection = Enum.FillDirection.Horizontal
  53. Layout.Padding = UDim.new(0, 10)
  54. end
  55.  
  56. function Library:GetButtonsSize()
  57. return (#Container:GetChildren() - 1) * 50
  58. end
  59.  
  60. -- Criação do som e variáveis de cooldown
  61. local lastPlayed = 0
  62. local sound = Instance.new("Sound", ScreenGui)
  63. sound.SoundId = "rbxassetid://762117042"
  64.  
  65. function playSound()
  66. local currentTime = tick()
  67. if currentTime - lastPlayed >= 0.5 then
  68. sound:Play()
  69. lastPlayed = currentTime
  70. end
  71. end
  72.  
  73. function Library:CreateButtons(Buttons)
  74. if type(Buttons) ~= "table" then
  75. return nil
  76. end
  77.  
  78. for _,Button in ipairs(Buttons) do
  79. if not Button.Callback then continue end
  80.  
  81. local Click = Instance.new("TextButton", Container)
  82. Click.Size = UDim2.new(0, 40, 0, 40)
  83. Click.BackgroundTransparency = 1
  84. Click.Text = ""
  85.  
  86. local Icon = Instance.new("ImageLabel", Click)
  87. Icon.Image = Button.Icon or "rbxassetid://115839646734512"
  88. Icon.Size = UDim2.new(0.7, 0, 0.7, 0)
  89. Icon.AnchorPoint = Vector2.new(0.5, 0.5)
  90. Icon.Position = UDim2.new(0.5, 0, 0.5, 0)
  91. Icon.BackgroundTransparency = 1
  92. Icon.ImageTransparency = 0.15
  93.  
  94. local Corner = Instance.new("UICorner", Click)
  95. Corner.CornerRadius = UDim.new(0.5, 0)
  96.  
  97. local Scale = Instance.new("UIScale", Click)
  98.  
  99. local Tweens = {
  100. Enter1 = TweenService:Create(Click, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { BackgroundTransparency = 0.8 }),
  101. Leave1 = TweenService:Create(Click, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { BackgroundTransparency = 1 }),
  102. Enter2 = TweenService:Create(Scale, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { Scale = 0.8 }),
  103. Leave2 = TweenService:Create(Scale, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { Scale = 1 })
  104. }
  105.  
  106. Click.MouseEnter:Connect(function()
  107. Tweens.Enter1:Play()
  108. Tweens.Enter2:Play()
  109. end)
  110.  
  111. Click.MouseLeave:Connect(function()
  112. Tweens.Leave1:Play()
  113. Tweens.Leave2:Play()
  114. end)
  115.  
  116. Click.MouseButton1Click:Connect(function()
  117. playSound() -- Toca o som com cooldown
  118. Button.Callback()
  119. end)
  120. end
  121. end
  122.  
  123. Library:CreateButtons({
  124. {
  125. Icon = "rbxassetid://115864540601762",
  126. Callback = function()end
  127. },
  128. {
  129. Icon = "rbxassetid://10734943448",
  130. Callback = function()end
  131. },
  132. {
  133. Icon = "rbxassetid://111429937040741",
  134. Callback = function()end
  135. },
  136. {
  137. Icon = "rbxassetid://10723417608",
  138. Callback = function()end
  139. }
  140. })
Advertisement
Add Comment
Please, Sign In to add comment