for i,Buttons in pairs(Gui:GetChildren()) do
for i,v in pairs(Buttons) do
v.MouseButton1Click:connect(function()
print(v)
end)
end
end
--bad argument #1 (table expected, got Object)
My Gui has 2 objects, shirt and pants but for some reason it gives out only "Shirt" so it doesn't creates table and gives out that error. Don't know what causes this problem

1 comment
if someone wonders, no "wait()" won't fix this problem, I tried