Infinite yeild error but script still works

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    a reason for the error im having / how to fix it
  2. What is the issue? Include screenshots / videos if possible!

15:42:15.704 Infinite yield possible on ‘Workspace.Tycoons.Tycoon.PurchasedItems:WaitForChild(“Dropper1”)’ - Studio
15:42:15.704 Stack Begin - Studio
15:42:15.704 Script ‘Workspace.Tycoons.Tycoon.Scripts.Core’, Line 44 - Studio - Core:44
15:42:15.704 Stack End - Studio

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    cant find any cant find a reason this is happening
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
if buttons then
	for i, v in pairs(buttons:GetChildren()) do
		spawn(function()
			if v:FindFirstChild("Button") then

				local newObject = PurchasedItems:FindFirstChild(v.Object.Value)
				if newObject ~= nil then
					Objects[newObject.Name] = newObject:Clone()
					newObject:Destroy()
				else
					v:Destroy()
				end

				if v:FindFirstChild("Dependency") then
					v.Button.Transparency = 1
					v.Button.CanCollide = false
					v.Button.BillboardGui.Enabled = false
					v.Button.Part.Transparency = 1
					v.Button.Part.CanCollide = false
					coroutine.resume(coroutine.create(function()
						if PurchasedItems:WaitForChild(v.Dependency.Value) then
							v.Button.Transparency = 0
							v.Button.CanCollide = true
							v.Button.BillboardGui.Enabled = true
							v.Button.Part.Transparency = 0
							v.Button.Part.CanCollide = true
						end
					end))
				end

image
the other buttons work just fine and that one does too it just prints that error still
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

2 Likes

Infinite yield warning means somewhere there is a :WaitForChild() that took over 5 (or was it 3?) to finish.

As it is a warning, it means that you should double check that stuff is loading correctly. If you don’t see any unexpected behavior, you can safely ignore it.

btw none of the code you’ve provided actually causes the warning.

2 Likes