How to make a nametag system!

How to make nametag system!

Hold on, if you dont wanna follow the tutorial, you can simply download the model by clicking here.

1. Make a new BillaboardGui in workspace
image
Once you done making the BillaboardGui, name it “NameTag”

2. Make 2 TextLabels, 1 upper text and one lower text.
The upper text will be the player name and the lower case will be the player rank
image
Once you done, desgin them however you want.

3. Move the BillaboardGui to ReplicatedStorage | game.ReplicatedStorage
image

4. Make a new script in ServerScriptService and script it!
image

game.Players.PlayerAdded:Connect(function(plr) -- Detects a new player that joins
	plr.CharacterAdded:Connect(function(char)
		local Nametag = game.ReplicatedStorage:WaitForChild("NameTag") -- Our nametag


		local clone = game.ReplicatedStorage:WaitForChild("NameTag"):Clone() -- Clones the nametag
		clone.Parent = char.Head -- Put the cloned nametag on the character head
		
		local UpperText = char.Head.NameTag.UpperText
		local LowerText = char.Head.NameTag.LowerText		
		
		UpperText.Text = plr.Name -- Makes the upper text the player name
		
		local owners = {123,1234,12345} -- Owners list, you can add someone by adding a comma(,)
				
		for i,v in pairs(owners) do -- Checks the table
			if v == plr.UserId then -- Checks if there is a user ID in the table
				LowerText.Text = "Owner" -- The lower text will be owner and everyone will be able to see it
				LowerText.TextColor3 = Color3.new(1, 0.85098, 0) -- Changing the text color to yellow
			end
		end
		--[[local admins = {123,1234,12345}
		
		for i,v in pairs(admins) do
			if v == plr.UserId then
				LowerText.Text = "Admin"
				LowerText.TextColor3 = Color3.new(1, 0, 0.0156863)
			end
		end--]]
	end)
end)

*If you need any help feel free to reply! - Thanks for reading

sorry if I forgot anything or explained bad, its just 3 AM for me, if you didnt understand anything feel free to reply

12 Likes

Thanks! I was looking for something like this for my game. If we want can we copy and paste this, say for roles?

EDIT: Where do we position the tag, it works which is good but it just gets put together in the middle of the player

3 Likes

It would be nice if we had some explanation on what the script does instead of just throwing it out for us to copy paste, I wouldn’t really consider this a tutorial since you don’t get anything out of this besides how to copy and paste code.

I mean, I did comments on each line

1 Like

In my opinion, comments are good enough for beginners to understand what the code does.

Sure, he could’ve went more in-depth, but at least he put effort into making sure people learned from it, unlike other tutorials, which is something.

3 Likes