Nametag not attaching with no errors

Hello! With the following script below, I’m trying to attach the BillboardGUI called Nametag in ReplicatedStorage to the head. When I attach the BillboardGUI to the part, I can see it, meaning that it should be visible on the head. However, I don’t see it. There are no errors or warnings, so I’m lost. Thanks for your help.

local GROUP_ID = 35485008
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		local head = character:WaitForChild("Head")
		local nametag = game.ReplicatedStorage:WaitForChild("Nametag"):Clone()
		nametag.Parent = head
		local u = nametag:WaitForChild("Frame"):WaitForChild("Username")
		local r = nametag:WaitForChild("Frame"):WaitForChild("Rank")

		if player.DisplayName == player.Name then
			u.Text = player.Name
		else
			u.Text = player.DisplayName .. " (@" .. player.Name .. ")"
		end

		local success, rank = pcall(player.GetRoleInGroup, player, GROUP_ID)
		r.Text = success and rank or "Guest"
	end)
end)

This is the hierarchy:

Try setting the Adornee property of the billboard gui to the head. Otherwise, make sure it’s enabled and set up correctly.

1 Like

I believe you need to set the adornee property of the BillBoardGui to the head

I added nametag.Adornee = head and it doesn’t work (did I script it correctly?) cc @LxckyDev

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		local head = character:WaitForChild("Head")
		local nametag = game.ReplicatedStorage:WaitForChild("Nametag"):Clone()
		nametag.Adornee = head
		nametag.Parent = head
		local u = nametag:WaitForChild("Frame"):WaitForChild("Username")
		local r = nametag:WaitForChild("Frame"):WaitForChild("Rank")

		if player.DisplayName == player.Name then
			u.Text = player.Name
		else
			u.Text = player.DisplayName .. " (@" .. player.Name .. ")"
		end

		local success, rank = pcall(player.GetRoleInGroup, player, GROUP_ID)
		r.Text = success and rank or "Guest"
	end)
end)```

I added the following, would this enable it?

nametag.Adornee = head
nametag.Enabled = true

It looks like you scripted it correctly. Try looking at the parent and adornee property of the script after pressing play. Maybe you have the script under a container where it doesn’t work (like ReplicatedStorage) also, check if your head is called “Head”

Thee is no adornee property to it, and the Parent is ReplicatedStorage. The script is just in ServerScriptService, and the head of the player is a MeshPart called Head.

I’m also confused as in my other game, this script works. When I uploaded it to my current game, it doesn’t.


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local head = character:WaitForChild("Head")
		local nametag = game.ReplicatedStorage:WaitForChild("Nametag"):Clone()
		nametag.Parent = head
		local u = nametag:WaitForChild("Frame"):WaitForChild("Username")
		local r = nametag:WaitForChild("Frame"):WaitForChild("Rank")
		if player.DisplayName == player.Name then
			u.Text = player.Name
		else
			u.Text = player.DisplayName .. " (@" .. player.Name .. ")"
		end
		local s, rank = pcall(player.GetRoleInGroup, player, GROUP_ID)
		r.Text = s and rank or "Guest"
	end)
end)```

Sorry, I meant check the BillboardGui for the adornee and parent property. I was able to make a script that sets the adornee property to the head, but not without issues.

If you’re testing this in Studio, your player can load in before that PlayerAdded connection is made. Does the nametag show when playing the game outsideof Studio?

1 Like

There is still no adornee property to it, and the Parent is ReplicatedStorage.

Could you explain what you mean outside of Studio?

If you’re the first player to load into the game, you’ll sometimes load in before Players.PlayerAdded can fire. A way around this would be to put this at the start of the script.

for _, v in game.Players:GetPlayers() do
	—your code
end
1 Like

Not playtesting in Studio, rather playing the published game inside the normal Roblox app.

It still isn’t showing in Studio.