For i,v in pairs not working

local InventoryScrollBar = script.Parent


while true do
	wait(1)
	for i,v in pairs(InventoryScrollBar) do
		print(i)
		print(v)
	end
end

Players.mariyandog999.PlayerGui.InventoryHandler.InventoryScrollBar.LocalScript:6: invalid argument #1 to ‘pairs’ (table expected, got Instance)

inventoryScrollBar is a Frame and I trying to get all the children of the Frame but then I got an error.

local InventoryScrollBar = script.Parent


while true do
	task.wait(1)
	for i,v in pairs(InventoryScrollBar:GetChildren()) do
		print(i)
		print(v)
	end
end

The parameter should be a table, not an instance.

3 Likes