Can anyone explain why I this script isn't working?


local rep = game:GetService("ReplicatedStorage")
local nametag = rep.NameTag


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)

		local head = char.Head
		local newtext = nametag:Clone()
		local namtext = newtext.PlayerName
		local ownertext = newtext.PlayerDisplayName
		local timetext = newtext.PlayerTime
		local humanoid = char.Humanoid
		
		humanoid.DisplayDistanceType = "None"
		

		newtext.Parent = head
		newtext.Adornee = head
		namtext.Text = player.Name 
		ownertext.Text = player.DisplayName
		timetext.Text = player.leaderstats.Time.Value
		
		player.leaderstats.Time:GetPropertyChangedSignal("Value"):Connect(function()
			timetext.Text = player.leaderstats.Time.Value
		end)
		

	end)
end)

the whole nametag isn’t showing at all

1 Like

Try adding print("CheckPoint1") in certain parts of the scripts, maybe the chracterAdded function doesnt even fire.

Are there any red underlines in the script or an errors printed in the Output?

no errors, no nothing. i think it might be the character added function

1 Like

try adding wait(5) after the functions but before the cloning section.
the ui might be cloning before the character fully loaded in

I assume the best way is just to debug it add print statements.
Is the part even getting added to the player’s head / adornee?
You stated the whole nametag isn’t showing what part isn’t showing? The Text GUI or???

You forgot to parent the text so do newtext.Parent = [UI]

the wait worked, thank you so much

1 Like

you gave yourself the solution lol

he has it later down the script, i thought so too