Player's display name appearing on the nametag only if they have a one

Hey, Just wanted to ask. Is it possible to make it so if the player has a display name it will appear on the nametag? only if they have a display name.

  • Thanks in advanced.

I have a question like this: https://devforum.roblox.com/t/roblox-username-tags-not-functioning-properly/1266770

here

Note that players always have a display name. If they didn’t set it then it’s just the username of player.

1 Like

alright thank you have a nice day

1 Like

You can use a localscript to determine this here’s an example if you put the script in the text part.

--//Variables

local plr = game.Players.LocalPlayer
local change = script.Parent

local PlayerID = plr.UserId

wait(.5)

change.Text = plr.Name

--//Script

if plr.DisplayName == plr.Name then
	print("PlayerName") -- change.Text = plr.Name
else
	print("DisplayName") -- change.Text = plr.DisplayName
end

Hey! So… if I’m understanding this situation correctly you want to check if there is a display name or not. You can achieve this by doing the following:

Object.Text = Player.DisplayName and Player.DisplayName or Player.Name

This sets an object’s text to the display name if there is one, otherwise it will use the regular player name.

1 Like

Thank u too, helped a lot. Have a nice day

1 Like