Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Output says "Infinite Yield possible' what did i do wrong?

Asked by 2 years ago

So im and referencing stuff for my custom chat and i have these variables ~~~~~~~~~~~~~~~~~ local Chat = script.Parent:WaitForChild("Chat") local list = Chat:WaitForChild("List")


Everything is named correctly i am sure of it but when i take of wait for child like this

local Chat = script.Parent:WaitForChild("Chat") local list = Chat.List ~~~~~~~~~~~~~~~~~ The output then says there is nothing called List in the Chat

It works in studio sometimes printing the infinite yield thing but it works most times yet on roblox it never works and outputs an error.

2 answers

Log in to vote
1
Answered by
Jo1nts 134
2 years ago

That means the thing you are waiting for isn't there and meaning it's possible it will be waiting for infinitley.

0
But it is there and it stops the script from running idk if there is any way to pcall it but everything is there once again Nifemiplayz 32 — 2y
0
play the game and look in your explorer if your item your trying to wait for is there Jo1nts 134 — 2y
0
NVM I just started a new project Nifemiplayz 32 — 2y
Ad
Log in to vote
0
Answered by
NGC4637 602 Moderation Voter
2 years ago
Edited 2 years ago

According to the roblox api reference manual, Infinite Yield Possible warning happens when:

a call to this function exceeds 5 seconds without returning, and no timeOut parameter has been specified, a warning will be printed to the output that the thread may yield indefinitely; this warning takes the form Infinite yield possible on X:WaitForChild("Y") , where X is the parent name and Y is the child object name.

so to stop it from giving this warning and wait forever, add a timeOut parameter, like this:

X:WaitForChild("Y",100) -- 100 is the timeOut parameter. with this, the waitforchild function will be capped at 100 seconds instead of inf seconds (without the timeout parameter).

More abt the waitforchild function

Answer this question