How to Exclude An Item From a Table

Hello, So I have a script that will print all the items that are inside the ScrollingFrame. The issue is that I also have other things inside the scrolling frame and the script will count those items as part of the table, is there a where the script only counts the image buttons.
Here is what I mean.
Screenshot 2022-03-25 124223
The table prints this as the first 3 items but I don’t want it to print/acknowledge those objects as part of the table.
This is what the scrolling frame looks like

this is the script

local PetsFolder = game.Players.LocalPlayer:WaitForChild("PetsFolder")
local Inventory = game.Players.LocalPlayer.PlayerGui.Inventory
local ScrollingFrame = Inventory.LowerInvFrame.ScrollingFrame


while true do 
	wait(3)
for i,v in pairs(PetsFolder:GetChildren()) do
		
first image
		
		for  i2,v2  in pairs(ScrollingFrame:GetChildren()) do
			
			
			
				print(v2)-- right here I print the array of items in the scrollingframe
				print(i2)
	end
	
		end
	end 
		

You just have to do

for i,v in ipairs(scrollingframe:GetChildren()) do
   if v:IsA("GuiButton") then -- just check if the child is a GuiButton or ImageButton
     -- code here
   end
end
1 Like