How can I make the name change color in TextChatService using TextChatMessageProperties?

Title says it all, how can I make the name of the player change in TextChatService?

Here is my code:

local textChatService = game:GetService("TextChatService")
local groupService = game:GetService("GroupService")

textChatService.OnIncomingMessage = function(message: TextChatMessage)

	local properties = Instance.new("TextChatMessageProperties")

	if message.TextSource then

		local player = game:GetService("Players"):GetPlayerByUserId(message.TextSource.UserId)
		if player then
			local rankInGroup = player:GetRankInGroup(8423759) -- replace this with your group ID

			if rankInGroup == 255 then -- replace the group rank ids with your desired ones
				properties.PrefixText = "<font color='#ad3335'><b>[Owner]</b></font> " .. message.PrefixText
				properties.Text = "<font color='##d84042'>" .. message.Text .. "</font>"
			elseif rankInGroup == 9 then
				properties.PrefixText = "<font color='#ff751f'><b>[Manager]</b></font> " .. message.PrefixText
				properties.Text = "<font color='#ff751f'>" .. message.Text .. "</font>"
			end
		end

	end

	return properties

end

Feel free to ask me if you need further explaining of this

1 Like

here is a link to a guide for what you are trying to achieve.