Nametag Won't Always Get Added To Player

Hey there! So I made this nametag, but there is one issue. So at first It seemed like the nametag would only show for one player. But soon I discovered that the nametag would only get added to the player if the player did not have a packaged head. Example of packaged heads are “Woman Head”, “Trim Head”, and any head that is not the default.

Here is the nametag cloning code:

local serverSt = game:GetService("ServerStorage") --You can change this to ServerStorage for more security.
local nametag = script.Tag

		local head = character.Head
		local newtext = nametag:Clone(nametag)
		local NameTag = newtext.NameTag
		local RankTag = newtext.RankTag
		local humanoid = character.Humanoid

		humanoid.DisplayDistanceType = "None"

		--Main Text
		newtext.Parent = head
		newtext.Adornee = head
		NameTag.Text = player.Name --Changes the text to the player's name.``

Also this is not the entire code. But the cloning and parenting part.

You can do a check if the Head has any special mesh or anything related, and do something about it.

Firstly there shouldn’t be any parameters inside of your Clone() function

Also when placing it into the head I would personally do local Head = character:WaitForChild("Head") to 100% ensure that the head is loaded before I proceed with the rest of my code, if there’s no other errors then you should look into potentially detecting if it is a special head and if so place the gui inside of the HumanoidRootPart or UpperTorso instead

Okay, I’ll see if that works. Thank you!

On the first line after the character added function put


which waits for the character to load fully, I had this problem when people had certain types of meshes as heads that took longer to load

It still does not add the nametag.

(I am morphing the player. Does this change anything?)

why cant you just do it on the humanoidrootpart since all character are ensure to have one and have nothing special with it if yk what i mean.

You mean the nametag should be added to the humanoidrootpart?

yeah adding the nametag to the hrp would be better.

Okay I’ll see if that works! Thank you.

After parenting it to the humanoidrootpart. It still does not show.

then it means it has to be the code.

This should fix your problem unless there is something else going on, do print checks

Morphing the player does do something, you’ll have to create a new tag every morph. You are changing the players character

Well, for players who have normal heads but morphed
Screen Shot 2022-09-20 at 5.47.29 PM
it works.

Maybe the code for different morphs is different? I can’t really help without the code for your morph system

Do on what this person said, do print debugging on each sections seeing what worked and what didnt and see if anything returns nil.

Okay, I’ll do that. Thank you!

I did some debugging, and managed to fix the issue! Thank you. It turns out the nametag script needed to be in ServerScriptService.

1 Like