Object Vanishes Shortly After Parenting To Character

So far, I want to have a nametag appear above the character as soon as they load. I have the following Script inserted:

local function CharLoad(c)
	local H = c:WaitForChild("Humanoid")
	local player = Players:GetPlayerFromCharacter(c)
	H.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

	local nt = nil
	if player.UserId == dictionary["Dasher89798"] then -- Add nametags
		nt = 0
	else
		nt = 1
	end
	for i,v in pairs(ServerStorage.Nametags:GetChildren()) do
		if nt == v:GetAttribute("TagNumber") then
			local tag = v:Clone()
			tag.Parent = c:WaitForChild("Head")
			tag.CFrame = c:WaitForChild("Head").CFrame
			local GUI = tag:WaitForChild("GUI")
			GUI.PlayerToHideFrom = player
			print("Nametag applied")
		end
	end
	
end

(The actual Script is larger. I’ve just trimmed away unnecessary parts for this post.)

This actually works perfectly, with the Print() function firing and everything. The issue, however, is the fact that when I check the Explorer for the nametag object, it doesn’t seem to exist. It doesn’t appear anywhere in the Explorer, much less where it’s supposed to be. Would anyone know why?

TL;DR: Nametag doesn’t exist, despite Script claiming it’s exactly where I want it to be.

Is this a local script or a server script?

1 Like

This is in a server Script. It’s also the Script with the first priority when parenting objects to the player’s character.

Oh, make sure tag is anchored:

Do:

	local tag = v:Clone()
			tag.Anchored = true
			tag.Parent = c:WaitForChild("Head")
			tag.CFrame = c:WaitForChild("Head").CFrame
  
1 Like

Nevermind, forgot to weld the thing to the player. Thanks for the heads-up, though.

1 Like