WaitForChild not working

So in my local script I used WaitForChild, but for some reason it’s infinte yeild even though it shouldn’t be. I also tried without WaitForChild and it still doesn’t work for some reason.
(CameraPart is the name).
Output:

Infinite yield possible on 'Workspace:WaitForChild("CameraPart")'

Screenshot:
Screenshot 2021-06-07 170652
Thank you for reading.

2 Likes

It is done locally. Therefore, the local player isn’t loading it in, causing it to be taking forever to find it. It is likely the way the Roblox rendering system is set up - the client cannot find the part, causing the script to error.

The fix? You can do a repeat loop until it loads (I don’t recommend). If this functionality can be moved to the server, then that would be even better. Best of luck!

1 Like

Do I loop the variable? Or the part it’s used?

1 Like

There are a couple things that could be affecting this. If you have StreamingEnabled, it may just not be loading in.

I don’t really know the solution, but I would google it.

Can you screenshot the explorer? the part might be at the wrong place or placed in a folder or something

filtering enabled has been deprecated and discontinued ages ago, so that is definitely not what is causing the problem here

I mispoke, I apologize @0Luke_Skywalker0 and @SilentSuprion. I meant to say StreamingEnabled.

That’s kind of the point by using waitforchild.

Is it? I don’t see where he mentions it.
@SilentSuprion is this a LocalScrpt? Where is this located? And definitely send us a screenshot of your explorer view. Does camera part exist at the start of the game, or is it created by a script?

It does, seeing it is defined in the image in the post.

@SilentSurprion, a screenshot of explorer would be greatly appreciated. I had a new thought, which may solve your problem - is the part anchored? If not, it may be falling out of the world, breaking the script.

1 Like

use your eyes to see/read the below stuff

2 Likes

Screenshot 2021-06-07 192005

Camera part is a part in workspace.

Maybe this will work…?

local Subject;
repeat wait() until workspace.CameraPart;
Subject = workspace:FindFirstChild("CameraPart")

For some reason it says:
Players.Rapideed.PlayerGui.LoadingGui.LoadingGui.LocalScript:19: attempt to index nil with ‘CFrame’

thats literally just what WaitForChild() does

That wouldn’t actually work anyways without FindFirstChild.
repeat wait() until workspace:FindFirstChild("CameraPart")

Oof it doesn’t work :frowning:

Is the part anchored? If not, is CanCollide set to true? Maybe it falls off the map or something else removes it or renames it.

1 Like

This triggers mean more than it does to everyone else. :smiley: hahaha not mad

1 Like

haha, things that happen :rofl: