'IsA' does not work find ImageButton help

Try this and see what it prints?

plerr.DropItem.Changed:Connect(function()
	print("Value Changed")
	for _,ImageB in pairs(InventoryGUI.ItemOrder:GetDescendants()) do
		if not ImageB:IsA("ImageButton") then continue end
		print("APP")
	end
end)

Have you tried printing something like this?

print((ImageB.ClassName == "ImageButton"), ImageB.ClassName)
-- this should print a boolean then the item's class

Add this before the if ImageB:IsA("ImageButton")

1 Like

Does not print “APP” Still. Thanks for the attempts.

Wait… In the image you provided the folder “ItemOrder” is inside of “ItemHolder”. This may be the issue.

1 Like

Yes I am calling from ItemOrder. Whats the problem with that?

Ill try that out. One moment Ill be back.

Your variable InventoryGUI is linked to ItemHolder?

This is not true. Both iterate through the table in an ascending order.

image

image

… Wait, let me try this. I’m pretty sure this is true.

Can you provide more context? Such as where you define “InventoryGUI”?

STRv Nprintfe

What does this mean then? Was that supposed to happen.

It was for debugging purposes, it means that the current ImageB wasn’t an ImageButton, which si correct as it was a UIGridLayout for you

1 Like

It was suppose to print either true or false and the item’s ClassName

local item = "Part"

print((item == "BasePart"), item)
-- prints "false, Part"
1 Like

The difference is; ipairs doesn’t iterate through indexes which aren’t ints and not following the previous int.

Ex.
image

Im lost honestly. I have tried what has been suggested. Any other ideas? I think it may have something to do with folders.

You… you are right! :astonished:

sorry for being dumb lol

Uh what should I do here guys? I dont think I can do this a lone.

Why you need to use GetDescendants()? From where is your .Changed event?

Try doing this in your code:

if Object:IsA("ImageButton") then
	print(Object.Name, "is a ImageButton!")
else
	print(Object.Name, "isn't a ImageButton.")
end

Please try this, so I can investigate further:

for _,ImageB in pairs(InventoryGUI.ItemOrder:GetDescendants()) do
	plerr.DropItem.Changed:Connect(function()
        print(ImageB)
	end)
end

Okay I will then. One moment I will be back.