'IsA' does not work find ImageButton help

IAr PrintIMBei

Is it not finding our frame? That is strange. Maybe the frame is not an item yet because I am adding the frame at the same time as I am changing plerr.DropItem to true?

I dont think that is it though.

Yeah, I do think that’s the issue.

1 Like

That could be what’s causing it as you’re not giving the game time to find it, maybe try adding a wait() between adding the frame and setting it to true

1 Like

Using wait() is bad practice!

Why?

Yes I know that, but using it in this case will help determine if there’s not enough time between both actions that it doesn’t show up during the loop. @OP can decide if he wants to find a better way to do it or not if it in the end was due to not enough time between both actions

for _,ImageB in pairs(InventoryGUI.ItemOrder:GetDescendants()) do
	InventoryGUI.ItemOrder.ChildAdded:Connect(function()
		print("DEF")
		if ImageB:IsA("ImageButton") then
			print("OVSE")
		end
	end)
end

It print “DEF” but wont print “OVSE”. Why do you think this is? The Image button is added before.

It’s probably the way you did it maybe try this

InventoryGUI.ItemOrder.ChildAdded:Connect(function()
	print("DEF")
	for _,ImageB in pairs(InventoryGUI.ItemOrder:GetDescendants()) do
		if ImageB:ISA("ImageButton") then
			print("OVSE")
		end
	end
end)

Edit: Forgot a bracket

1 Like

You are very right. Okay thanks Ill see if the rest works out.