I somehow cannot clone BillboardGuis into character head's

So I was trying to make a overhead gui which states your name.
Now I somehow cannot clone BillboardGuis anymore, the names are correct, they are writen correct in the code.
Code:

local plr = game.Players.LocalPlayer

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		wait(1)
		local name = game.ServerStorage.Name:Clone()
		name.Parent = char.Head
		name.TextLabel.Text = plr.Name
	end)
end)
3 Likes

I’m assuming that there is a Billboard Gui named “Name” in ServerStorage. Is Archivable set to true?

1 Like

Archivable was set to true, why?

1 Like

I think the problem is that you’ve already assigned a value to the variable. Here’s an example:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		wait(1)
		local name = game.ServerStorage.Name:Clone()
		name.Parent = character:WaitForChild("Head")
		name.TextLabel.Text = player.Name
	end)
end)

Another problem is that the object in the server storage is called “name”.Rename it because it could assign to a property of the server storage.

1 Like

So like, I could change it to playerName or something

yeah but also change it in the code then!

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		wait(1)
		local name = game.ServerStorage.playerName:Clone()
		name.Parent = character:WaitForChild("Head")
		name.TextLabel.Text = player.Name
	end)
end)
1 Like

Have you checked the Player’s head has loaded yet?

You might want to use .CharacterAppearanceLoaded instead, that way they get given name tags upon the appearance being loaded in its entirety or you can yield for the head.

I might be wrong but when I try putting a Billboard Gui in ServerStorage it disappears. That might be something on my side though.

1 Like

Thats because everything thats in workspace is visible, otherwise not.

Yeah thats why i said he should use “WaitForChild”

1 Like

Not like that, when I go into the Explorer it isn’t there. I went to the documentation and it says that objects in ServerStorage are not replicated to the client and have to be accessed differently.

Was answering independent of all solutions and with additional information which he might want to take note of :man_shrugging:

1 Like

I know how to check when something is there or not, but thanks for the reminder!

1 Like

I put the Gui in ReplicatedStorage instead and that fixed it. Try doing that if that won’t mess up anything in your game.

Edit: The code I used is
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) wait(1) local name = game.ReplicatedStorage:WaitForChild("Name"):Clone() name.Parent = char.Head name.TextLabel.Text = plr.Name end) end)

You shouldn’t reference the plr outside by the way.

Your issue upon analysis is you’ve named your NameTag the same as an property of ServerStorage.

If you change it to:

local plr = game.Players.LocalPlayer

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		wait(1)
		local name = game.ServerStorage.NameTag:Clone() -- editation here
		name.Parent = char.Head
		name.TextLabel.Text = plr.Name
	end)
end)

It works, you can’t obviously :Clone() the name of something.

1 Like

Here you go!

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function() 
	    local Tag = game.ServerStorage.Tag:Clone() -- Put The Name Tag name Here
	repeat wait() until game.Workspace:FindFirstChild(player.Name).Head
  Tag.Name = "NameTag"
	    Tag.TextLabel.Text  = player.Name
	    Tag.Parent = game.Workspace:FindFirstChild(player.Name).Head
end)
end)

I tested it out! It works! (To Fix the Nil head issue, I added the repeat wait() until the head loads! :slight_smile:)

yeah I get it, but i made it that it goes to the object, not the name of the object ofcourse

1 Like

By doing game.ServerStorage.Name, it automatically sets precedence to the property and not the child - you can’t technically force this unless you made your own table which is game. Computers don’t have logic, it just assumes the property it found first is what your looking for.

By doing :WaitForChild() you specified your looking for the child, this is the only easy workaround.

1 Like

Thanks, but a WaitForChild() works aswell

1 Like

It does, I use that more often but sometimes I trust the repeat wait() until a bit more! :slight_smile: