Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Library = {}
- -- Função para criar um botão redondo com duas texturas
- function Library.NewButton(parent, buttonText, buttonInfo, outerTextureId, innerTextureId, innerSize, outerSize, position, buttonSize, callback)
- local button = Instance.new("TextButton")
- button.Size = buttonSize -- Tamanho do botão
- button.Position = position -- Posição do botão
- button.BackgroundTransparency = 1 -- Transparente para texturas
- button.Parent = parent
- -- Criação da imagem externa (textura externa)
- local outerImage = Instance.new("ImageLabel")
- outerImage.Size = outerSize -- Tamanho da textura externa
- outerImage.Image = outerTextureId -- Textura externa definida aqui
- outerImage.BackgroundTransparency = 1
- outerImage.Parent = button
- -- Criação da imagem interna (textura interna)
- local innerImage = Instance.new("ImageLabel")
- innerImage.Size = innerSize -- Tamanho da textura interna
- innerImage.Position = UDim2.new(0.5, -innerSize.X.Offset / 2, 0.5, -innerSize.Y.Offset / 2) -- Centraliza a textura interna
- innerImage.Image = innerTextureId -- Textura interna definida aqui
- innerImage.BackgroundTransparency = 1
- innerImage.Parent = button
- -- Criação do TextLabel para o texto dentro do botão
- local innerLabel = Instance.new("TextLabel")
- innerLabel.Size = UDim2.new(0.8, 0, 0.8, 0)
- innerLabel.Position = UDim2.new(0.1, 0, 0.1, 0) -- Centraliza o TextLabel
- innerLabel.Text = buttonText
- innerLabel.BackgroundTransparency = 1
- innerLabel.TextColor3 = Color3.fromRGB(255, 255, 255) -- Cor do texto
- innerLabel.Parent = button
- -- Tooltip ou info do botão
- button.MouseEnter:Connect(function()
- innerLabel.Text = buttonInfo -- Altera o texto ao passar o mouse
- end)
- button.MouseLeave:Connect(function()
- innerLabel.Text = buttonText -- Retorna ao texto original
- end)
- -- Função de callback ao clicar no botão
- button.MouseButton1Click:Connect(function()
- callback()
- end)
- -- Estilo redondo
- button.ClipsDescendants = true
- button.BorderSizePixel = 0 -- Sem borda
- button.BackgroundColor3 = Color3.new(1, 1, 1) -- Cor de fundo (opcional)
- end
- -- Função para criar um botão com TextLabel (apenas uma textura)
- function Library.NewTextButton(parent, buttonText, buttonInfo, textureId, size, position, callback, labelText)
- local button = Instance.new("TextButton")
- button.Size = size -- Tamanho do botão
- button.Position = position -- Posição do botão
- button.BackgroundTransparency = 1 -- Transparente para texturas
- button.Parent = parent
- -- Criação da imagem (textura única)
- local textureImage = Instance.new("ImageLabel")
- textureImage.Size = UDim2.new(1, 0, 1, 0)
- textureImage.Image = textureId -- Textura definida aqui
- textureImage.BackgroundTransparency = 1
- textureImage.Parent = button
- -- Criação do TextLabel para o texto dentro do botão
- local innerLabel = Instance.new("TextLabel")
- innerLabel.Size = UDim2.new(0.8, 0, 0.8, 0)
- innerLabel.Position = UDim2.new(0.1, 0, 0.1, 0) -- Centraliza o TextLabel
- innerLabel.Text = labelText or buttonText -- Texto padrão se labelText não for fornecido
- innerLabel.BackgroundTransparency = 1
- innerLabel.TextColor3 = Color3.fromRGB(255, 255, 255) -- Cor do texto
- innerLabel.Parent = button
- -- Tooltip ou info do botão
- button.MouseEnter:Connect(function()
- innerLabel.Text = buttonInfo -- Altera o texto ao passar o mouse
- end)
- button.MouseLeave:Connect(function()
- innerLabel.Text = labelText or buttonText -- Retorna ao texto original
- end)
- -- Função de callback ao clicar no botão
- button.MouseButton1Click:Connect(function()
- callback()
- end)
- -- Estilo redondo
- button.ClipsDescendants = true
- button.BorderSizePixel = 0 -- Sem borda
- button.BackgroundColor3 = Color3.new(1, 1, 1) -- Cor de fundo (opcional)
- end
- return Library
Advertisement
Add Comment
Please, Sign In to add comment