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

What is it warning "infinite yield possible on"?

hello all! What this is warning problem? -- https://imgur.com/a/W5DUNvO

buyUpdate:

local player = game.Players.LocalPlayer
while true do
	wait(.1)
                if script.Parent.Parent.Parent:WaitForChild("Value"):WaitForChild("SwordBoost1") then
	            local v = script.Parent.Parent.Parent:WaitForChild("Value"):WaitForChild("SwordBoost1")
				if player.Tools[script.Parent.Parent.Parent:WaitForChild("Value"):WaitForChild("SwordBoost1").SwordBoostParent.Value].Value == true then
					if player.ToolEquiped.Value == script.Parent.Parent.Parent:WaitForChild("Value"):WaitForChild("SwordBoost1").SwordBoostParent.Value then
					local toolTemplate = script.Parent.Parent.Parent:WaitForChild("Value"):WaitForChild("SwordBoost1")
					local sel = toolTemplate:WaitForChild("Sel")
					sel:WaitForChild("Stats").Text = "Equipped"      
					else
					local toolTemplate = script.Parent.Parent.Parent:WaitForChild("Value"):WaitForChild("SwordBoost1")
					local sel = toolTemplate:WaitForChild("Sel")
					sel:WaitForChild("Stats").Text = "Equip"                    
				 end
			end
     end
end

SeeStats:

script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Parent.Parent.Parent.Parent.Value:FindFirstChild("SwordBoost1") then
		local st = script.Parent.Parent.Parent.Parent.Parent.Value.SwordBoost1.SwordBoostParent
		script.Parent.Parent.Parent.Parent.Parent.Value.SwordBoost1.Visible = false
		script.Parent.Parent.Parent.Parent.Parent.Value.SwordBoost1.Parent = script.Parent.Parent.Parent[st.Value]
		local valueFrame = script.Parent.Parent.SwordBoost1
	    valueFrame.Parent =  script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Value")
	    valueFrame.Visible = true
	else
		local valueFrame = script.Parent.Parent.SwordBoost1
	    valueFrame.Parent =  script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Value")
	    valueFrame.Visible = true
	end
	end)

Where is problem warning or no have? A have to need fix problem warning? :)

1 answer

"Infinite yield possible on" means that a WaitForChild() function has been waiting for a child for too long, and that it could possibly be waiting for that child forever potentially causing lag. That can happen because the child either took too long to appear/load on the desired place or the child doesn't exist.

Example:

workspace:WaitForChild("Part") --//Waits for a child named part

It will wait for a child named "Part" to appear, but if it takes too long for the child to appear on workspace or the child doesn't exist then you will get the "Infinite yield possible on" warning.

1 comment

0

Got another interesting question: what is the difference between script.Parent is long?

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