'IsA' does not work find ImageButton help

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

Issue:Does not print “APP” in console when their is ImageButtons are clearly a descandant of InventoryGUI. I do not understand why I am having this issue please help.DEcsh

Script returns no errors but cannot find image button to be a descendant.

Have you tried changing it? If you havent then do that.

It’s probably because the event isn’t firing. Can you tell me why you have the plerr.DropItem.Changed?

1 Like

Changing what sorry? I do not understand.

The event is firing. I have tested it.

Well, you have plerr.DropItem.Changed so you have to change that if you want the thing to work.

I am aware. It changes in another section of the script. I just tested it again.

Thanks though. I appreciate you trying to help me out.

1 Like

Wait… I’m not sure about this, though maybe you could try:

plerr.DropItem.Changed:Connect(function()
    for _, ImageB in ipairs(InventoryGui.ItemOrder:GetDescendants()) do
	    if ImageB:IsA("ImageButton") then
		    print("APP")
	    end
    end
end)

Edit after 2 minutes:
I do not understand why this would fix the issue, though you can try.

2 Likes

Okay Ill give that a shot. Thanks.

It did not work sadly. Thanks though.

I was just about to post that exact same thing haha. But that looks to be the solution since it would loop everything the value is changed rather than making a single loop and making tons of changed events

1 Like

Maybe try using pairs instead of ipairs?

Or as @iamajust mentioned, the event is probably not firing. where are you changing its value?

Then it has to be the event not firing.

What are you trying to do?

SOx

If this is enough proof for you hahaBakV

1 Like

ipairs is basically pairs, but ipairs goes through the table in order, while pairs does it in random order. ipairs is faster than pairs, because when you use pairs the computer has to generate a random order. Of course, we’re talking about unnoticeable differences, but I still prefer it.

So this basically can’t be the issue.

You’re not using the code @iamajust made, you’re still using the old faulty code. Try using his with a bit of printing to debug

Thats old Ik. I tried the new version. Here Ill try agian.

I dont know what to say. It dont work???