If the title did not explain it: I hve many UIs with many folders inside of them with masny buttons and with many frames, so making a ton of loops to get to buttons would be way too custom for each UI and create massive code trees.
I was wondering if there is a simpler way of obtaining all of the UI button instances.
Note: All buttons are under StarterGUI and are SurfaceUIs
local Buttons = {}
for i,v in pairs(game.StarterGui:GetDescendants()) do
if (v:IsA("TextButton")) --[[or whatever you want]] then
Buttons[#Buttons+1] = v
end
end
print("Found "..tostring(#Buttons).." buttons.")
print(Buttons)
local Buttons = {}
for i,v in parirs(game.StarterGui:GetDescendants()) do
if v:IsA("TextButton") or v:IsA("ImageButton") add others here then
table.insert(Buttons,v)
end
end