Animate multiple buttons at once

Currently with a project I’m working on, there are a lot of buttons and I was wondering if I’m able to animate them all at the same time by their Class instead of having them animated individually.

This is my current setup right now:

local holder = script.Parent
local MainUI = holder.Holder
local Blur = holder.Blur

local CommandHolder = MainUI.Commands
local InputHolder = MainUI.Inputs

local Buttons = CommandHolder:GetChildren()
local Inputs = InputHolder:GetChildren()

(Under Commands are TextButtons and under Inputs are TextBoxes)

I also currently have

if Buttons:IsA("TextButton") then
	
end

but I’m not really sure if this is how you do it.

1 Like

Please be more descriptive about “animating the buttons”

You can use a for loop. For instance,

for i,v in pairs(Buttons) do
--Tween here
end
2 Likes

What I mean by “animating the buttons” is tweening them sorry for the misunderstanding.

You could run a for loop that checks if the button should be animated and if it should fire a function to animate

local function tweenUi(v)
	-- what ever you want to do to ui
	
end
for _, v in pairs(frame:GetChildren()) do
	if v:IsA("WhatClassYouWant") then
		tweenUi(v)
	end
end
1 Like