Why It Shows "Infinite Yield" Even If The Object Is There?

Alright, So I’m Currently Making Something For My Game I’m Using WaitForChild("")
For The UI But When I Play It Shows The Error “Infinite Yield Possible On LoadingScreen”.

When I Check The PlayerGui ( Where I’m Putting The WaitForChild ) It Shows That It’s There And It’s Still Saying Infinite Yield Which Completely Breaks The Code.

Hope Someone Solves This :smiley:

1 Like

Because you’re wating for an object with an empty name, the first argument is a name and not an empty string.

which type of script are you using?

Local Script In Starter Player Scripts.

It’s Not An Empty String I’m Just Showing As WaitForChild("")

limit

Try doing this: WaitForChild(“Object”,1)

He means what did you put between the two quotation marks in :WaitForChild(" ")??

did you check the capitalisation?

Try something like this, I ain’t sure if it’s correct though.

local StarterGui = game:GetService("StarterGui")
local LoadingScreen = StarterGui:WaitForChild("LoadingScreen")

-- code here

Example:

local StarterGui = game:GetService("StarterGui")
local LoadingScreen = StarterGui:WaitForChild("LoadingScreen")

-- if its a frame do
    LoadingScreen.Visible = true 

    -- if its a guiholder thing do
    LoadingScreen.Enabled = true

StarterGui doesn’t affect a player’s UI.

Because WaitForChild() Needs To Be A String

can you show us that piece of code which is occurring the error?

No i mean did you put something like say :WaitForChild(“name”)?

You don’t put “” into WaitForChild though unless you have an object with an empty name.

1 Like

Try adding a ,1 after the string. Like this,

local LoadingScreen = StarterGui:WaitForChild("LoadingScreen",1)

No, it should have a children’s name in there for it to reference a child with :WaitForChild()

I Just Tried That I Said Din’t Work.

StarterGui won’t affect the PlayerGui as I said again.

Ok, I’ll let someone else reply to you because i replied 3 times

PlayerGui is used in serverscript not LocalScript it could and would recomend it.