Hello! I’m back, today I will show you how to create an overhead gui which shows the player’s name; you will learn how to create 2 different types of it.
- Create a BillboardGui with a TextLabel, like this:
- Put the BillboardGui in ReplicatedStorage;
- Insert a Script in ServerScriptService;
Name only
Write this into the script:
game.Players.PlayerAdded:Connect(function(player) --here we create a player variable when someone joins the game
player.CharacterAdded:Connect(function(character) --here we create a character's variable of the joined player
local gui = game.ReplicatedStorage:WaitForChild("NameGui"):Clone() --here we clone the BillboardGui, NOTE: change "NameGui" with the name of your BillboardGui
gui.Parent = character.Head --here we put the cloned gui in the player's head
gui.Adornee = character.Head --here we change the adornee of the gui to the player's head
gui.PlayerName.Text = player.Name --here change the text with the player's name, NOTE: change "PlayerName" with the name of your TextLabel
end)
end)
Team color name
Write this inside the script:
game.Players.PlayerAdded:Connect(function(player) --here we create a player variable when someone joins the game
player.CharacterAdded:Connect(function(character) --here we create a character's variable of the joined player
local gui = game.ReplicatedStorage:WaitForChild("NameGui"):Clone() --here we clone the BillboardGui, NOTE: change "NameGui" with the name of your BillboardGui
gui.Parent = character.Head --here we put the cloned gui in the player's head
gui.Adornee = character.Head --here we change the adornee of the gui to the player's head
gui.PlayerName.Text = player.Name --here change the text with the player's name, NOTE: change "PlayerName" with the name of your TextLabel
gui.PlayerName.TextColor = player.Team.TeamColor --here we set the text color to the color of the team of the player, NOTE: change "PlayerName" with the name of your TextLabel
end)
end)
This is all for today, have a nice day!