Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why am I getting this Infinite Yield I do not see any errors in my script?

I am working on a devil fruit loader. And I keep getting this Infinite Yield. It's messing up the whole loader. So it doesn't work.

Error: 14:44:25.012 - Infinite yield possible on ReplicatedStorage.DevilFruits:WaitForChild("_Fruit")'

script:

		local dfmoves = game:GetService("ReplicatedStorage").DevilFruits:WaitForChild(data:WaitForChild("DevilFruit").Value.."_Fruit")
		local dfgui = game:GetService("ReplicatedStorage").DevilFruits.GUIs:WaitForChild(data:WaitForChild("DevilFruit").Value.."_GUI")

		for i, v in pairs(dfgui:GetChildren()) do
		v.Disabled = false
		v:Clone().Parent = player.Backpack
		end
		
		-- Give Moveset
		for i, v in pairs(dfgui:GetChildren()) do
		wait(1)
		v.Enabled = true
		v:Clone().Parent = player.PlayerGui
		end
	end

2 answers

✓ Accepted answer

InfinteYield isn't actually in the script, it's more of an identifier. InfinteYield mostly appears in the console when :WaitForChild() is waiting for too long, to fix this make sure all of your :WaitForChild() functions have the right names, etc, etc.

Hope this helped. :3

1 comment

0

Thats why I make my own custom functions -.-

The warn message Infinite Yield occurs when a specific function like WaitForChild does a specific action, ie, waiting for a child named "potato" (or whatever the first argument is).

This warn message usually appears is so that the scripter will know what's going on instead of looking at their script and wondering why aren't some stuff are working.

WaitForChild is a function which yields ("pause") a script forever until a specific child with the name that matches with the first argument is parented under the instance. If you do not add a child with the name that matches the first argument, the function will yield the script indefinitely or for an infinite amount of seconds.

Using WaitForChild

local ham = Instance.new('Part',workspace);
ham:WaitForChild'Cheese';
print'Now I need bread'; -- < this does not print until an instance named "Cheese" is parented under the Instance we declared "ham"

This discussion is preserved as it was. New answers, comments, and votes are closed.