Infinite yield possible even though its there

You can write your topic however you want, but you need to answer these questions:
Hi,
for some reason in my output it says Infinite yield possible on ‘Players.EzraPalo.PlayerGui.InventoryGui.InventoryFrame.ItemsFrame:WaitForChild(“Komodo Dragon”)’ - Studio

I check in the explorer, and it is there, so im not sure whats the problem.
Ive looked at other posts, but none of them seem to solve my problem.
Heres my code:

local prompt = script.Parent.ProximityPrompt

prompt.Triggered:Connect(function(player)
	for i, v in player.Inventory:GetChildren() do
		if v.Name == "Net" then continue end
		local name = v.Name
		local itemButton = player.PlayerGui.InventoryGui.InventoryFrame.ItemsFrame:WaitForChild(name)
		itemButton:Destroy()
		print("destroyed")
	end
end)

Thanks in advance!

Are you sure you have the parenting correct? It’s lost on trying to find your “Komodo Dragon” UI. Double check the parenting or even naming matches.

1 Like

I’m guessing this is a server script. Are you sure that the itemButton exists on the server side?

2 Likes

ohhhh
it is a server script, and the buttons are created on the client side, so i need to make it a local script. Thanks!!

2 Likes