What Does Player.DisplayName Return When Not Set by the Player?

1. What do you want to achieve?
I want to understand what value the Player.DisplayName property returns when a player has not set a custom display name. Does it default to their Player.Name, or something else?

2. What is the issue?
I’m unclear about how Player.DisplayName behaves when the feature is unused by a player. This can impact how I display names in my game, especially if I want to show display names in some areas and usernames in others. Here’s a sample code block I’m working with:

local player = game.Players.LocalPlayer
print(player.DisplayName)

I’ve seen both Player.Name and Player.DisplayName being used interchangeably, but I want to clarify the behavior when DisplayName is not set.

3. What solutions have you tried so far?
I’ve looked through the Developer Hub but haven’t found clear documentation on what happens if a player hasn’t configured a display name. I’d like to understand the default behavior across various accounts.

1 Like

What do you mean by display name not set? Every Roblox account has a display name.

2 Likes

When I say “display name not set,” I’m talking about accounts that haven’t chosen to customize their display name. While every Roblox account has a display name, some older accounts may still show their original username if they haven’t updated it. I’d like to know what Player.DisplayName returns for those accounts. Does it show their username, or is there another behavior for accounts without a customized display name?

1 Like

I apologize for the confusion! I just learned that Player.DisplayName will return the username if a player hasn’t customized their display name. Essentially, the display name is set to the username by default. Thank you for your understanding!

If you see those accounts that haven’t customized their display name, their display name is by default their same as their user name, as both are same, that property actually returns display name