Table expected, got instance and not sure why

i’m not sure why it’s doing this… but it is giving me an error. saying invalid argument. table expected, got instance.

for _, v in pairs(petsFrame:FindFirstChildWhichIsA('Frame')) do
		if v.PetId.Value == petId then
			v:Destroy()
		end
	end

You are missing :GetChildren() in the in pairs brackets


Should be:


for _, v in pairs(petsFrame:FindFirstChildWhichIsA('Frame'):GetChildren()) do
1 Like

i ended up using this and it works…

for _, v in pairs(petsFrame:GetChildren()) do
		if v:IsA('Frame') and v:FindFirstChild('PetId').Value == petId then
			v:Destroy()
		end
	end

that wouldn’t do what i wanted it to do.

How I am suppose to know what is your hierarchy of the frames? I just fixed the error because the frame was instance and you missed :GetChildren() after it.

1 Like

cuz ur suppose to be psychic.
rfg

1 Like