Incorrect "Infinite yield possible" warnings

  1. What do you want to achieve?
    In the Output, it shows “Infinite yield possible” warnings when I shouldn’t. I want to know if there is a way to get rid of these.
  2. What is the issue?
    {411A0096-2602-444E-8793-CE7D15776BA7}.png
    These are the lines that are causing these warnings:
local gui = playerGui:WaitForChild("ResetGui")
local backpack = player:WaitForChild("Backpack")
local gui = player:WaitForChild("PlayerGui"):WaitForChild("BuildGui")

The objects are being replicated, and my scripts are not breaking because of this. It appears that these are just useless messages that clutter up the Output. The Backpack warning does not appear every time I run it, but the BuildGui and ResetGui warnings do. It doesn’t exactly cause problems, but it takes up space in the Output and is pretty annoying. Is there something I can do to fix this?

2 Likes

Try putting a value of math.huge in the second parameter, I’m pretty sure anything above 5 seconds will not have on of the warnings in the output. Example:

playerGui:WaitForChild("ResetGui", math.huge)

2 Likes

These are just warnings. Sometimes the client takes a bit to load in, due to settings up the client or waiting for the server to finish sending data. :WaitForChild has default yield of 5 seconds, and if it waits longer than that, it issues this warning. You can plug a value like math.huge into the second parameter to prevent these warnings.

Thanks @NeonD00m and @ThatTimothy for your help! This behavior seems a bit weird (it gives a warning, but the script still works), but adding math.huge fixed it.

1 Like