Display Name Overhead Name

Hey, yes, it’s an overhead username & display name nametag. Took me like 2 minutes, lol.
Anyways, enjoy.

Preview:

Link for the model: Name Tag - Roblox

(yes, thank you Lua_Orb for the idea I saw on cool creations.)

2 Likes

Yo, I have a similar thing in my game with display names as well, but is there a way to enable / disable the displayname header if the user does not have a DisplayName? By default the DisplayName would just be the same as the PlayerName if they don’t have one set, right?

I’m kinda just new to LUA so i’m not sure how to disable the label that contains the Displayname if they just don’t have one.

1 Like

Yep, you can check if the player has a display name or not by if their username matches their display name.

For example, if the player’s Display name is their username, you can just disable the display name header, if their display name doesn’t match their username, you keep the display name header

1 Like

I figured you can just do a check, but with how my headers are set up, I’m not sure exactly how I would go about that without either 2 things happening:

  1. It just looks weird in game
  2. Makes my code look messy

If it looks weird, nothing I can do about it. /shrug
You can just disable display names entirely though.

It’s up to you what do you.

Well, here’s what I was thinking:

	header.Label.Text = "Level ".. level.Value
	header.Label2.Text = "- ".. groupRole .. " -"
	header.Label3.Text = player.DisplayName
	header.Label4.Text = "@"..player.Name

So, this is how I have my labels stacked. Wouldn’t I just do some check where if the displayname and username are the same it would just disable the playername label?

Yeah, if a player hasn’t set their display name, it’s their username by default.

Alright, now new challenge for me is figuring out the syntax for matching the display (Label3) and playernames and then just “hiding” the playername label (Label4)

Good luck fellow comrade :grin:
I’m happy that I could help you out :+1:

1 Like

I appreciate the help! If I can’t get this to work i’m just going to harass you with block of code.

1 Like

I just realized I have no real way of testing to see if this works, most of my friends have display names.

	if player.DisplayName == player.Name then
		header.Label4.Text = nil
	end

That should just hide it right?

I wouldn’t recommend setting the value nil as it might break, you can use a space though. Like " ", and yes, it should work.

1 Like

Yeah that’s true, thank you :smiley:

I’ve only been learning LUA for like the last 2 weeks so everything is a struggle for me.

2 Likes