How would I be able to create a chat where players are anonymous?

Hi, I am trying to make a game like the Disguises gamemode from MM2 and I can’t figure out how to make the players anonymous. Please help.

9 Likes

I don’t play much MM2, so is this “Chat” in the game chat?

3 Likes

Well, for example when a player chats their name gets turned into another name like: “CoolGamer123” becomes “Josh”.

3 Likes

Consider using Prefix in the chat. Basically from this post from roblox:

This is what they do for a VIP Tag

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local props = Instance.new("TextChatMessageProperties")
	
	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		
		if player:GetAttribute("isVIP") == true then
			props.PrefixText = "<font color='#F5CD30'>[VIP]</font> " .. message.PrefixText
		end
	end
	
	return props	
end

However I think we can change this script and do:

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local props = Instance.new("TextChatMessageProperties")
	
	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		
		
			props.PrefixText = "Anonymous" -- If you want different names for each player, then replace with your own system and pick a new name for each players
		
	end
	
	return props	
end

Please make sure this script is a local script inside StarterPlayerScripts. Also use the next chat system TextChatService

3 Likes

That is perfect! I appreaciate the help! Let me try it.

3 Likes

Thanks for the help but the script isn’t working. Chats still show up like this:
Screenshot 2023-08-07 000728

3 Likes

You made sure to do all of this?

3 Likes

image
Yes, I sure did as you can see here.

3 Likes

That is in ServerScript Service. It needs to be in StarterPlayer < StarterPlayerScripts

2 Likes

It works! Sorry if I am a bit of an idiot :cry: lol. Thanks a lot!

5 Likes

Could you use a custom chat box and then use Roblox filtering? Just use a text box, and make it able to create a text label using Instance.new that contains the text.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.