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

How to use the timeOut argument in WaitForChild()?

Asked by 7 years ago

Hello, I am making a script that uses the "require" statement to get an object reference from a ModuleScript which uses WaitForChild(). When I hit the debug switch, I get a warning telling me that I have an infinite yield. I previously asked a question about what an infinite yield is, and the answer I was given told me that I needed to use the timeOut argument, but I was given a vague explanation of the timeOut argument. I went to look it up on the ROBLOX Wiki, and the timeOut argument wasn't explained very well. Can you give an example of code using the timeOut argument?

2 answers

Log in to vote
0
Answered by 7 years ago

After reading that, time out is how long it wants until it is nil. Time out is a number until it goes nil. That what is basically says.

Read this for more information: http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild

Ad
Log in to vote
0
Answered by 7 years ago

The new TimeOut argument of the WaitForChild method defines the maximum time (In seconds) that it should wait for the child before resuming the thread and returning nil

Answer this question