Expected " : " not " . " calling member function WaitForChild

image

I have a problem with my current loading script, where when the game starts it gives an error, resulting that the player isn’t able to load in.
I’m using WaitForChild to make sure that all object are loaded in such as lobby etc. it works fine mostly, but it does give me error sometimes without reason.

local wfc			= game.WaitForChild
local Lobby				=wfc(workspace, "Lobby", 10)
local mainMenuCameraPart=wfc(Lobby, "MainMenuCamera", 10)

If I don’t use WaitForChild it will also sometimes load the script faster before the Instances are replicated also resulting in errors.

I also used the same thing some lines above, and they never return errors, but when using waitforchild at the mainmenu camara part, it does.

The self argument does not work like this, if you’re attaching WaitForChild to an instance it should correspond to the self argument.

Also why do you need to make WaitForChild into a function?

I don’t fully understand what you mean by this

local Lobby = workspace:WaitForChild("Lobby")
local mainMenuCameraPart = workspace:WaitForChild("MainMenuCamera")

In shorter terms, just use Instance:WaitForChild not game.WaitForChild(Instance)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.