How do I disable DisplayNames in the new TextChatService?

I would like to have people’s real username pop up in chat when they type but I cannot seem to find a setting to disable DisplayNames in chat.
Example
I have tried to remove DisplayNames from the player’s character’s Humanoid but that does not affect the chat.

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

no scripting required :slight_smile:

1 Like

I just tried this and it did not work, it still shows my display name in chat.

2 Likes

Have you checked the ChatSettings module in the Chat service? There should be a setting called “PlayerDisplayNamesEnabled” in it. Setting it to false will use usernames instead of display names in the chat.

You can find the module by testing the game in Studio then going to Chat > ClientChatModules > ChatSettings. You only need to copy the folder itself and the ChatSettings module. Then you can stop the game and paste them back into the Chat service to make your changes.

The new chat is a different service, so there is no chat module.

1 Like

Oh, sorry about that. I haven’t been on Studio for a while. Let me check that and see if I can find a solution.

Edit:

tl;dr - Roblox really limited customization on the new chat by not providing its code so I don’t have any easy solution. Sorry.

I might still just be getting used to the new chat but it seems like they really limited the chat by sacrificing full customization for convenience. There doesn’t seem to be any accessible code of the chat to modify, only options and APIs. Plus they moved the new chat GUI from the player’s PlayerGui to CoreGui so you can’t even modify the GUI itself.

Currently, the only workarounds I can think of are to just use the old chat or to make a custom chat GUI that looks very similar to the new one, add some of your own code to it, then connect it to the relevant APIs.

1 Like

You can check the messages by modifying the TextChatMessages given by TextChatService.OnIncomingMessage

--!strict
-- this is on the client
local PlayersService = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")

local function onIncomingMessage(message: TextChatMessage)
	local source = message.TextSource
	local player = if (source) then PlayersService:GetPlayerByUserId(source.UserId) else nil
	
	if (not player) then return end
	
	message.PrefixText = string.gsub(message.PrefixText, player.DisplayName, player.Name)
end

-- callbacks (like OnIncomingMessage) can only be set to one function
-- if you're setting this callback multiple times, you may have to combine the
-- function above with any other functions you're connecting
TextChatService.OnIncomingMessage = onIncomingMessage
6 Likes

I’ll try it out, if it works I’ll mark you as the solution!
Edit: I tried it out, it work’s thank you!

Where do I put this local script at?