How to use multiple buttons in one function

Hello,

I need help trying to figure out how I can use multiple button in one function.

For example: If I want to combine 5 buttons into 1 “local” value how would I do this?

I need help figuring out how to make the frame run when a button is click. I don’t want to type out Button.MouseButton1Click 2 times so I need help figuring out how to combine all buttons into 1 mousebutton1click

My code:

You could use a for loop for this,

for i, button in pairs(Buttons) do
    button.MouseButton1Click:Connect(function()
        ...
    end)
end
6 Likes