How do you make a team overhead nametag?

How do you make a team overhead nametag? Not a group rank.

8 Likes

You could start by creating a BillboardGUI model and include fields in it like the TextLabel that’ll display their name, and anything else you want in it. You can either do two things here: Create an individual tag for each team, or, have the code modify a single BillboardGUI depending on the team. It’s really your preference. It may be easier to have separate ones; but potentially cleaner to have the code do it. Either way is fine.

From there, you could create a function we can call when ever we want to update the character’s tag. This will be handy because for example, if we need to update their tag if their team changes; not just when their character joins in the game.

I’ll write you a simple example that’ll work if you go with the tag-per-team method:

local tag_storage = game.ServerStorage --//Where the tags will be stored
local function Update_Tag(player) --//Player is passed in so we can get their team
local char = player.Character
local new_tag = tag_storage:FindFirstChild(player.Team.Name) --//Attempt to find the player's team's tag if there is one. Name the tags exactly the same as the team names.
if char:FindFirstChild("Tag") then
char.Tag:Destroy() --//Destroy old tag if one exists
end
if new_tag then
new_tag = new_tag:Clone() --//Create new instance of the tag for this player
new_tag.Name = "Tag" --//Rename it so we can find it in the player if this function is called again
new_tag.Adornee = char:WaitForChild("Head")
new_tag.Enabled = true
new_tag.Parent = char
end
end

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char) --//Used to automatically create player tags when players rejoin
repeat wait() until workspace:FindFirstChild(player.Name) --//Used to bypass an issue when using this event
Update_Tag(player)
end)
end)

Untested, but I hope this helps get you started. :slight_smile:

12 Likes

Thank you so much for you help!

4 Likes

Hi is there a way to make it so players can only see their own teams names and not the others? I want to use it in my game with a large map so teammates can find eachother (6000 studs) but I don’t want the enemy to see them. Awesome script