Disabling Display Names

Hello Developers, I am trying to make a script that disables display names, here is the script I have so far, it doesnt work, and I am not sure why.

local plr = game:GetService("Players").LocalPlayer
local Player = game.Players.LocalPlayer

plr.PlayerAdded:Connect(function()
	Player.DisplayName = Player.Name
end)

Edit: Out put is saying that "Player Added is not a vaild member of PLayer “Players.Bear23913”

How am I able to fix this?

1 Like

Plr points to the local player, not the player service.

There is no way to disable display names on the leaderboard. There is a way to disable it on the character’s head though.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		task.wait()
		character:WaitForChild('Humanoid').DisplayName = player.Name
	end)
end)

What do you mean by that sorry?

Thank you so very, much does this go in a script in server script or in starter player script in a local script?

You are trying to use playeradded on a player Instance. game.Players.PlayerAdded is the correct way to do it.

This script will go in a server script, if it doesn’t work reply here and I’ll help.

There’s actually no scripting required for this: Humanoid | Roblox Creator Documentation

When a Humanoid named StarterHumanoid is parented to StarterPlayer, … [t]he engine will only override the DisplayName property of the Humanoid with the DisplayName property of the player if the StarterHumanoid ’s DisplayName property is an empty string.

In other words

  1. Stick a Humanoid inside StarterPlayer
  2. Name it “StarterHumanoid”
  3. Set its “DisplayName” to an empty string
4 Likes

Was a typo, I fixed it now. But basically what @Aeplexi said.

Wow, I didn’t know that! My method still works though, but yours is better.

Thank you very much, both of you for solutions to this problem!

You’re welcome! It’s also possible to disable display names in chat if you’re wondering about that, or if you already did that.

If you’re still available, how would I go about doing this? I’m able to disable display names on the leaderboard but unsure how to do so for the chat.

Just for anyone still trying to use this method but not working. You need to set the DisplayDistanceType to None. This will then work.

Hope this helps.