Why is char.Head returning as nil?

In the past, the script I made to give a player a BillboardGui worked, but suddenly it seems to have broken on all the games I use it on. The issue appears to be with getting the Character’s Head.

Of course, I grab the Character via Player, and the Character’s Head, and assign head to nameGui.

local char = plr.Character or plr.CharacterAdded:Wait()
local head = char.Head
local nameGui = head:FindFirstChild("BioGui")

But the line of issue (17) is:

local nameLabel = nameGui:FindFirstChild("BioLabel")

which returns:

ServerScriptService.ChangeNameScript:17: attempt to index nil with 'FindFirstChild' 

in the Output.
This has never happened before with this script and it used to work perfectly. To double check if Head was still parented to Character, I went to my test dummy and found that it was still the case, and checked the Developer reference site, to the same answer…

Have things formerly parented to Character been moved, or has the plr shorthand been deprecated? That’s the only reason I can come up with for these things no longer working.

For further clarification though it really shouldn’t matter because the new version of the script (above) does the same exact thing, the old version of this script didn’t create a call for head at all and just called char.Head straight up. Of course this was broken as well, implying the issue appear to be with char.Head.

local char = plr.Character or plr.CharacterAdded:Wait()
local nameGui = char.Head:FindFirstChild("BioGui")

local nameLabel = nameGui:FindFirstChild("BioLabel")

Try with local char = workspace:WaitForChild(game.Players.LocalPlayer.Name)
Also put a FindFirstChild for the head

No dice.

local head = char:FindFirstChild(Head)

returning

Argument 1 missing or nil


Where did Head go.

EDIT: Changing char:FindFirstChild(Head) to char:FindFirstChild("Head") works but the same issue from before arises.

local nameLabel = nameGui:FindFirstChild("NameLabel")
returns
ServerScriptService.ChangeNameScript:18: attempt to index nil with 'FindFirstChild'

(ignore that “BioLabel” etc is suddenly “NameLabel” theyre. the same script.)

nameGui is returning nil. Not head. If head were nil you would get an error where you define nameGui. This means BioGui is not parented to the player’s head when you call it.

Except I do parent it to the head in another script.

nameGui.Name = "BioGui"
nameGui.Parent = char.Head

(I’ve already called char here: plr.CharacterAdded:Connect(function(char))

when do you parent it? I’m assuming that these scripts aren’t coordinating with one another. The first script could be trying to get the biogui before the other has parented it

local char = plr.Character or plr.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
local nameGui = head:FindFirstChild("BioGui")

When the player joins the game, BioGui should create itself and parent itself to the Head.

game.Players.PlayerAdded:Connect(function(plr)


	plr.CharacterAdded:Connect(function(char)


		local nameGui = Instance.new("BillboardGui")

		nameGui.StudsOffset = Vector3.new(0, 3, 0)

		nameGui.Size = UDim2.new(0, 200, 0, 50)

		nameGui.Name = "BioGui"
		nameGui.Parent = char.Head

		nameGui.MaxDistance = 100

When the player wants to change the text on this it will send the info via RemoteEvent after the player clicks on the confirm button.
Don’t understand how this could unsync…

This works perfectly fine on an older game of mine still. Hm.

try changing last line to this

local nameGui = head:WaitForChild("BioGui", 10)

are any of the two scripts you mentioned local scripts? because if you create the gui in a local script it wont replicate to the server

No dice, same error.

local nameGui = head:FindFirstChild("BioGui")

local nameLabel = nameGui:FindFirstChild("BioLabel")

returns
ServerScriptService.ChangeBioScript:18: attempt to index nil with 'FindFirstChild'

that looks the same. Change it to wait for child

local nameLabel = nameGui:WaitForChild("BioLabel")

Change this too

Aaand still returns the same thing, just swap “FindFirstChild” with “WaitForChild” in the error message.
What on earth.

Should I just drop my full scripts here and see if the issue lies somewhere else?

Change everything from FindFirstChild to WaitForChild

That’s what made that error return that way.

The same error?
Send me the line that errors

did you change the nameLabel variable and the nameGui variable?

----edit----
they both should be waitforchild

local head = char:WaitForChild("Head")

local nameGui = head:WaitForChild("BioGui", 10)

local nameLabel = nameGui:WaitForChild("BioLabel")