Why won't my nametag script work? Please help!

Like this, correct?

local nametag = game:GetService("ServerStorage").BillboardGui

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)

		local leaderstats = player:WaitForChild("leaderstats")
		local timeAlive = leaderstats:WaitForChild("Time Alive")
		local BillboardGUI = nametag:Clone()
		BillboardGUI.Parent = char:FindFirstChild("Head")
		BillboardGUI.NameLabel.Text = player.Name
                wait (1)
		BillboardGUI.TextLabel.Text = tonumber(timeAlive.Value)

		local humanoid = char:WaitForChild("Humanoid")
		humanoid:GetPropertyChangedSignal("Health"):Connect(function()
			BillboardGUI.HP.Text = humanoid.Health 
		end)
	end)
end)

The timer went up to “1” and stopped there…

local players = game:GetService("Players")
local nametag = game:GetService("ServerStorage").BillboardGui

players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)

	    local leaderstats = player:WaitForChild("leaderstats")
	    local timeAlive = leaderstats:WaitForChild("Time Alive")
	    local BillboardGUI = nametag:Clone()
	    BillboardGUI.Parent = char:FindFirstChild("Head")
	    BillboardGUI.NameLabel.Text = player.Name
        wait(1)
	    BillboardGUI.TextLabel.Text = tonumber(timeAlive.Value)

	    local humanoid = char:WaitForChild("Humanoid")
	    humanoid:GetPropertyChangedSignal("Health"):Connect(function()
		    BillboardGUI.HP.Text = humanoid.Health 
	    end)
    end)
end)

Just use this script:

game.Players.PlayerAdded:Connect(function(player)
    if not player.Character then player.CharacterAdded:Wait() end
    -- Do what you want here.
end)

By “donated robux” you mean timeAlive?

@ProBaturay ,
image

The timer stopped at “1” and froze there.

This is correct I guess. . . .

Sorry I meant timeAlive. I feel so sleepy. :yawning_face: I don’t know what I’m writing.

Everything almost worked except the time just went to 1 and stopped there for some reason…

If you have a script out of this script and if it handles the timer so just use

timeAlive.Changed:Connect(function()
    BillboardGUI.TextLabel.Text = tonumber(timeAlive.Value)
end)

Add those before last three lines.

Make sure nametag remains in ServerStorage. Then:
(Used it in our boombox game so I know it works)

local Players = game:GetService'Players';
local ServerStorage = game:GetService'ServerStorage';
Players.PlayerAdded:Connect(function(Player)
       Player.CharacterAdded:Connect(function(Character)
              local Clone = ServerStorage:WaitForChild'BillboardGui';
              Clone = Clone:Clone();
              Clone.Parent = Character.Head;
       end)
end)

Also if you say you should have cloned it at the start, you’re wrong. You must clone it every time a plr joins.

The script finally works as intended! :partying_face:

Thank you for your help man!

(Marked your post as a solution)

1 Like

I’m happy to help you! :slightly_smiling_face:

1 Like