This is my code and I am trying to Wait for the model "Conveyer2" and then I want to get the children of it. I want to make another Collector for the Droppers to come into for my tycoon game.
for i,v in pairs(script.Parent.PurchasedObjects:WaitForChild("Conveyer2"):GetChildren()) do if v.Name == "PartCollector" then v.Touched:connect(function(Part) if Part:FindFirstChild('Cash') then Money.Value = Money.Value + Part.Cash.Value Debris:AddItem(Part,0.1) end end) end end
If it is saying Infinite yield, it is probably because you put the script on the wrong place and it cannot find `"Conveyer2".
Possible solutions:
Try checking is Conveyer2 is being spawned in the right place;
Check if script is in the right place;
Check if you named everything correctly.
correct representation: Link
Basically Infinite yield is that the game suspects that something wont't happen on waitforchild because its taking long.