Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Library = {}
- local TweenService = game:GetService("TweenService")
- local CoreGui = game:GetService("CoreGui")
- local ScreenGui = Instance.new("ScreenGui", CoreGui)
- ScreenGui.IgnoreGuiInset = true
- local Border = Instance.new("Frame", ScreenGui) do
- Border.Size = UDim2.new(0, 48, 0, 48)
- Border.Position = UDim2.new(0, 280, 0, 4)
- Border.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- Border.BackgroundTransparency = 0.3
- Border.ClipsDescendants = true
- Border.Active = true
- local OpenClose = Instance.new("ImageButton", Border)
- OpenClose.Size = UDim2.new(0, 40, 0, 40)
- OpenClose.Position = UDim2.new(0, 4, 0.5, 0)
- OpenClose.AnchorPoint = Vector2.new(0, 0.5)
- OpenClose.Image = "rbxassetid://115839646734512"
- OpenClose.BackgroundTransparency = 1
- local Corner = Instance.new("UICorner", OpenClose)
- Corner.CornerRadius = UDim.new(1, 0)
- Corner:Clone().Parent = Border
- OpenClose.Activated:Connect(function()
- if Border:GetAttribute("Opened") then
- Border:SetAttribute("Opened", false)
- OpenClose.BackgroundTransparency = 1
- Border:TweenSize(UDim2.new(0, 48, 0, 48), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.5, true)
- else
- Border:SetAttribute("Opened", true)
- local NewSize = UDim2.new(0, Library:GetButtonsSize() + 48, 0, 48)
- OpenClose.BackgroundTransparency = 0.8
- Border:TweenSize(NewSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.5, true)
- end
- end)
- end
- local Container = Instance.new("CanvasGroup", Border) do
- Container.Size = UDim2.new(1, -48, 1, 0)
- Container.Position = UDim2.new(0, 48, 0, 0)
- Container.BorderSizePixel = 0
- Container.BackgroundTransparency = 1
- local Layout = Instance.new("UIListLayout", Container)
- Layout.VerticalAlignment = Enum.VerticalAlignment.Center
- Layout.FillDirection = Enum.FillDirection.Horizontal
- Layout.Padding = UDim.new(0, 10)
- end
- function Library:GetButtonsSize()
- return (#Container:GetChildren() - 1) * 50
- end
- -- Criação do som e variáveis de cooldown
- local lastPlayed = 0
- local sound = Instance.new("Sound", ScreenGui)
- sound.SoundId = "rbxassetid://762117042"
- function playSound()
- local currentTime = tick()
- if currentTime - lastPlayed >= 0.5 then
- sound:Play()
- lastPlayed = currentTime
- end
- end
- function Library:CreateButtons(Buttons)
- if type(Buttons) ~= "table" then
- return nil
- end
- for _,Button in ipairs(Buttons) do
- if not Button.Callback then continue end
- local Click = Instance.new("TextButton", Container)
- Click.Size = UDim2.new(0, 40, 0, 40)
- Click.BackgroundTransparency = 1
- Click.Text = ""
- local Icon = Instance.new("ImageLabel", Click)
- Icon.Image = Button.Icon or "rbxassetid://115839646734512"
- Icon.Size = UDim2.new(0.7, 0, 0.7, 0)
- Icon.AnchorPoint = Vector2.new(0.5, 0.5)
- Icon.Position = UDim2.new(0.5, 0, 0.5, 0)
- Icon.BackgroundTransparency = 1
- Icon.ImageTransparency = 0.15
- local Corner = Instance.new("UICorner", Click)
- Corner.CornerRadius = UDim.new(0.5, 0)
- local Scale = Instance.new("UIScale", Click)
- local Tweens = {
- Enter1 = TweenService:Create(Click, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { BackgroundTransparency = 0.8 }),
- Leave1 = TweenService:Create(Click, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { BackgroundTransparency = 1 }),
- Enter2 = TweenService:Create(Scale, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { Scale = 0.8 }),
- Leave2 = TweenService:Create(Scale, TweenInfo.new(0.4, Enum.EasingStyle.Quint), { Scale = 1 })
- }
- Click.MouseEnter:Connect(function()
- Tweens.Enter1:Play()
- Tweens.Enter2:Play()
- end)
- Click.MouseLeave:Connect(function()
- Tweens.Leave1:Play()
- Tweens.Leave2:Play()
- end)
- Click.MouseButton1Click:Connect(function()
- playSound() -- Toca o som com cooldown
- Button.Callback()
- end)
- end
- end
- Library:CreateButtons({
- {
- Icon = "rbxassetid://115864540601762",
- Callback = function()end
- },
- {
- Icon = "rbxassetid://10734943448",
- Callback = function()end
- },
- {
- Icon = "rbxassetid://111429937040741",
- Callback = function()end
- },
- {
- Icon = "rbxassetid://10723417608",
- Callback = function()end
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment