Roblox studio, how would I go about making a custom display name above the player in…
- User
Roblox studio, how would I go about making a custom display name above the player in studio? Just like maybe a different font?
Assistant
Of course! This is a great way to add a unique touch to your game. You can't directly change the font of the default Roblox name tag, but you can easily create your own custom one by disabling the default tag and adding a
BillboardGui.Here is a complete step-by-step guide on how to do it.
Step 1: Create the Main Script
This script will run for every player who joins the game, find their character, and then add the custom name tag to them.
- In the Explorer window in Roblox Studio, find the ServerScriptService folder.
- Right-click on
ServerScriptServiceand select Insert Object > Script. - You can rename this new script to something descriptive, like
CustomNameTag.
Step 2: The Script Itself
Open the script you just created and replace the default
print("Hello world!")with the code below. I've included detailed comments to explain what each part does.-- Wait for the Players service to be available local Players = game:GetService("Players") -- This function will run every time a new player's character is added to the game local function onCharacterAdded(character) -- Find the Humanoid within the character model. This is essential for control. -- We use WaitForChild to make sure the Humanoid has loaded before we continue. local humanoid = character:WaitForChild("Humanoid") -- Find the player object associated with this character local player = Players:GetPlayerFromCharacter(character) if not player then return end -- Stop if we can't find the player -- 1. DISABLE THE DEFAULT ROBLOX NAME TAG -- ========================================== -- We set the display distance to None to hide the default name and health bar. humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None -- 2. CREATE THE CUSTOM NAME TAG -- ========================================== -- A BillboardGui is a special GUI that always faces the camera. local billboardGui = Instance.new("BillboardGui") billboardGui.Name = "CustomNameTagGui" billboardGui.AlwaysOnTop = true -- Make sure it's not hidden by other objects billboardGui.Size = UDim2.new(0, 200, 0, 50) -- Size in pixels (width, height) billboardGui.StudsOffset = Vector3.new(0, 2.5, 0) -- Position it 2.5 studs above the head billboardGui.Adornee = character:WaitForChild("Head") -- Attach it to the player's head billboardGui.Parent = character:WaitForChild("Head") -- Put the GUI inside the head -- Now, create the TextLabel that will show the name local textLabel = Instance.new("TextLabel") textLabel.Name = "DisplayNameLabel" textLabel.Parent = billboardGui -- Place the label inside our BillboardGui -- 3. CUSTOMIZE THE APPEARANCE (This is the fun part!) -- =================================================== textLabel.Text = player.DisplayName -- Use DisplayName to show the player's chosen name textLabel.Font = Enum.Font.FredokaOne -- <<-- CHANGE YOUR FONT HERE! textLabel.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text textLabel.TextScaled = true -- Scales the text to fill the label textLabel.TextStrokeTransparency = 0 -- Makes the outline visible (0 = opaque, 1 = transparent) textLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0) -- Black outline for readability textLabel.BackgroundTransparency = 1 -- Makes the label's background invisible textLabel.Size = UDim2.new(1, 0, 1, 0) -- Make the label fill the entire BillboardGui end -- This function runs whenever a new player joins the game local function onPlayerAdded(player) -- Connect the onCharacterAdded function to the CharacterAdded event. -- This means whenever the player's character spawns (or respawns), our function will run. player.CharacterAdded:Connect(onCharacterAdded) end -- Connect the onPlayerAdded function to the PlayerAdded event. -- This starts the whole process when a player joins. Players.PlayerAdded:Connect(onPlayerAdded)Step 3: How to Customize It
This script is now fully functional. To change the font and other properties, look for the section commented with
CUSTOMIZE THE APPEARANCE.Changing the Font
This is your main request. Simply change the value of
Enum.Font.FredokaOne.textLabel.Font = Enum.Font.FredokaOne -- <<-- CHANGE YOUR FONT HERE!Click on
FredokaOnein the script editor. A dropdown menu will appear with all the available fonts you can choose from.Some popular choices include:
Enum.Font.SourceSansBold(The default Roblox font)Enum.Font.GothamSemiboldEnum.Font.CartoonEnum.Font.FantasyEnum.Font.Antique
Other Common Customizations
-
Text Color:
-- Set to a nice blue color textLabel.TextColor3 = Color3.fromRGB(0, 170, 255) -
Position Above Head: Change the
StudsOffsetproperty. The second number (Y-axis) controls the height.-- Move it slightly higher billboardGui.StudsOffset = Vector3.new(0, 3, 0) -
Text Outline (Stroke): Change the
TextStrokeColor3andTextStrokeTransparency.-- A thick white outline textLabel.TextStrokeColor3 = Color3.fromRGB(255, 255, 255) textLabel.TextStrokeTransparency = 0.5 -- Make it semi-transparent -
Size of the Name Tag: Change the
Sizeproperty of thebillboardGui. The200is the width and the50is the height in pixels.-- Make it wider for long names billboardGui.Size = UDim2.new(0, 250, 0, 60)
Just hit Play to test your game, and you will see your new custom name tag above your character!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.