As this article states " * Characters generated with LoadCharacter or by the Roblox engine will have their Humanoid’s DisplayName property assigned to the Player’s DisplayName property."
Basically just check if the DisplayName in the players humanoid is nil or the same as the players name as ComplicatedParadigm said
local function getLabelText(Player)
local Name = Player.Name
local Display = Player.DisplayName
return Name ~= Display and Display .. " - (" .. Name .. ")" or Name
end
As far as I’m aware, the DisplayName is automatically set to the Username if someone doesn’t have one.
So I’d follow this advice:
So for example:
local Player = game:GetService("Players").LocalPlayer
if Player.DisplayName == Player.Username then
(Your Text Label Location).Text = "@" .. Player.Username
else
(Your Text Label Location).Text = Player.DisplayName
end
I’m not that great at scripting so the code may be wrong