Hello, this is my first tutorial! pls don’t criticize
In this tutorial you can learn to create player-specific or non player-specific name tags above a player’s head!
Step 1: Creating the Nametag Object
For this step, you will first need to create your actual GUI for the name tag.
Step 1.1: Create a BillboardGUI inside of the workspace (so you can see what ur doing!)
Step 1.2: Set the StudsOffset of the BillboardGUI to 0, 1.5, 0 and the Size to {4,0},{1,0}
Step 1.3: Add a TextLabel and customize it to your liking, making sure it fits within the BillboardGUI!
Step 1.4: Set the Size of the TextLabel to 1,0,1,0
Step 1.5: Put it all in ReplicatedStorage for later!
(Mine are called Jobs because that went with my game, you can call it whatever!)
Step 2: Script the Nametag (Player-specific version)
This step assumes that you have the player name as a variable already, and replace rs.jobTag with rs.nameTag (or whatever it is.)
local rs = game:GetService("ReplicatedStorage")
local jobTag = rs.jobTag
local char = game.Workspace:FindFirstChild(tostring(player))
local newJobtag = jobTag:Clone()
newJobtag.Parent = char.Head
newJobtag.Adornee = char.Head
newJobtag.job.Text = "Replace this with your name tag text!"
Let’s break this down a bit!
Line 1 obtains the service ReplicatedStorage, which contains any object that can be cloned out somewhere else in the game.
Line 2 gets the name tag from ReplicatedStorage.
Line 3 gets the Character of the player you are setting the name tag to, which contains the body parts. Line 4 creates a clone of the name tag that you put in replicated storage earlier, so multiple players can have a name tag.
Line 5 sets the Parent of the cloned name tag to the head of the specific player.
Line 6 sets the Adornee of the cloned name tag also to the head.
Line 7 is whatever you want your nametag to say, mine was Student because of my game.
Step 3: Script the Nametag (Non-player specific version)
Now if you don’t need a player specific version, a version that gives a player a name tag when they join, here it is!
local rs = game:GetService("ReplicatedStorage")
local jobTag = rs.jobTag
players.PlayerAdded:Connect(function(player)
local char = game.Workspace:FindFirstChild(tostring(player))
local newJobtag = jobTag:Clone()
newJobtag.Parent = char.Head
newJobtag.Adornee = char.Head
newJobtag.job.Text = "Replace this with your name tag text!"
end)
This is very similar to the other one, here’s the breakdown!
Line 1 gets ReplicatedStorage.
Line 2 gets the JobTag from it.
Line 4 detects when a player joins the game.
Line 5 gets the character from the player that joined the game.
Line 6 clones the JobTag from replicated storage.
Lines 7-8 set the Parent and Adornee to the player’s head.
Line 9 sets the text of the nametag!
Line 10 ends the function off!
Thanks for reading through my tutorial, whether you did it or not thanks for viewing!
- Very helpful
- Helpful
- Average
- Not very useful
- Everyone knows how to do this
0 voters