Hello! I’m trying to index certain children under a surface gui, and when i test or play the game, and try to index the text box for instance, it keeps return as nil, or that it cant find what its trying to look for. In the workspace in the test it says it is there, but the scripts cant seem to index it. Archivailable is on, and i’ve tried to print the location of what i’m trying to index in the command bar, but still nothing. Does anyone have any ideas about this?
can you paste some code or photo of it pls
local CharacterStuff = game.Workspace.Spawn_Game.Gyspy_Circus.CharacterStuff
local NameBoard = CharacterStuff.NameBoard:WaitForChild("Name"):WaitForChild("Info")
local DescBoard = CharacterStuff.DescBoard:WaitForChild("Desc"):WaitForChild("Info")
NameBoard.Text = Name
DescBoard.Text = Desc
This is in the server, but it’s a surface gui and should work in the server the “Info” is whats coming up nil. The “Name” or “Desc” which is the surface gui’s themselves are being indexed.
You could set it via localscript and place the localscript in CharacterStuff
so it would be like
local NameBoard = script.Parent.NameBoard.Name.Intro
no waitforchild needed (I believe) since the localscript is present in the gui itself
i too dont understand why use wait for chield i declarate this like “example.example.example” and it work
Hmm it was weird, i deleted the text box and redid it, and redid it, and now its working
WaitForChild is used if you want to refrence something that is going to be placed there but is not there yet
This is not true. Even though an object exists in Studio, it still may not load in time while in game. Though it is quite excessive, WaitForChild
is not improperly used in @Manelin 's code.
Alright, thanks for correcting me. Didn’t know