How can I recolor the '[Team]' text in a team chat message?

image
image
even modifying the text, prefix text and so on i cant get the team color to change. and when i asked AI, it kept giving me code where the properties dont even exist

2 Likes

The properties exist when you click “Play” in studio.

On the client, you can find the Gui for TextChatService in the CoreGui.

On the server, you can find the code for TextChatService in the image below.

The code you are looking for is this. It is located in the “Team” ModuleScript.

1 Like

Openning that module gives me nothing, every module for me in CoreGui is empty

1 Like

Go to “Test” on the topbar, and change to “Server View”

1 Like

Yeah i just realized that, but how can i modify this code if coregui is empty before playing? is there a way to access coregui modules ?

1 Like

Should be, let me conduct a test rq

1 Like

This is definitely possible. I solved another user’s problem regarding eliminating team colour from messages. What’s your code?

1 Like
local TextChatService = game:GetService('TextChatService')
local Players = game:GetService('Players')

TextChatService.OnIncomingMessage = function(message)
	local properties = Instance.new("TextChatMessageProperties")

	if not (message and message.TextSource and message.TextChannel) then
		return properties
	end

	local player = Players:GetPlayerByUserId(message.TextSource.UserId)
	if not player then
		return properties
	end

	properties.Text = message.Text
	properties.PrefixText = message.PrefixText

	if properties.PrefixText then
		properties.PrefixText = player.Name .. ': '
	end

	if message.TextChannel and string.find(message.TextChannel.Name, 'RBXTeam') then
		local teamColor = player.TeamColor.Color
		local colorString = string.format("%d, %d, %d", 
			math.floor(teamColor.R * 255),
			math.floor(teamColor.G * 255),
			math.floor(teamColor.B * 255)
		)
		properties.Text = string.format('<font color="rgb(%s)">%s</font>', colorString, message.Text)
	end

	return properties
end

This is my code, its just turning displayNames to regular names & making it that the player textcolor is the team color like the legacy chat system.

To make it clear, im making a custom team color system that doesnt require the change of the actual teams color, so obviously im modifying the message prefix text color & its text color

My issue is that the ‘[Team]’ part isnt a prefix or a property to my knowledge and i dont know how to change its text color

1 Like

Here is more info for you. Still testing. Got this while testing via Client side.

This is not me changing the color, just showing you where it is located for “Prefix”

1 Like

Alright, I’ve looked at the code.

You are on the right path, and I think if you adjust your code you can make it work.


TXS.OnIncomingMessage = function(message: TextChatMessage)

	local properties: ChatWindowMessageProperties = message.ChatWindowConfiguration:DeriveNewMessageProperties()
-- You created a new ChatMessageProperties. You can just get it using this command.
	
	properties.PrefixTextProperties.PrefixText = `` -- rich text 


--	https://create.roblox.com/docs/reference/engine/classes/TextChatMessage#PrefixText

end

Let me know if this works. I haven’t tested it myself.

This doesnt work , nor does this property exist

1 Like

And also the [Team] text isnt a prefix,

1 Like

Didnt you say you solved another users problem? whyd you stop responding

1 Like

I’m out and about. I answered your post on downtime with the intention to further the conversation, not answer it with haste. This is the problem I solved

2 Likes