Changing the name of the chatter [Chat Tags, TextChatService]

Hello, I need help with my chat tag system made by Katrist. Basically, I’ve been trying to get it that you can set the name color of the chatter.

	[255] = "<font color='#F5CD30'>[⚡God]</font>",
-- and then like at the end another piece that lets you choose the color of the name.

Example:

Code:

-- Thank you too @Katrist for Writing the script

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

local groupId = #### -- # Out Just Because

local tags = {
	[255] = "<font color='#F5CD30'>[⚡God]</font>",
	[254] = "<font color='#4287f5'>[🔨Developer]</font>",
	[253] = "<font color='#4287f5'>[🔨Developer]</font>",
	[214] = "<font color='#9c1df0'>[🛠️President]</font>",
	[212] = "<font color='#9c1df0'>[🛠️Head of Staff]</font>",
	[203] = "<font color='#2af0be'>[🌴Community manager]</font>",
	[202] = "<font color='#9b1df0'>[🛠️Admin]</font>",
	[200] = "<font color='#e1a9f5'>[🔧Moderator]</font>",
	[111] = "<font color='#83feec'>[🛠️Affiliate]</font>",
	[110] = "<font color='#ff8b07'>[🔥Partner]</font>",
	[101] = "<font color='#F5CD30'>[⭐️Supporter]</font>",
	[100] = "<font color='#63e848'>[✨Vip Dog]</font>",
}

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

	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		local rank = player:GetRankInGroup(groupId)

		if tags[rank] then
			props.PrefixText = tags[rank] .." ".. message.PrefixText
		end
	end

	return props
end
Quick details

Script in:
StarterPlayerScripts

Type of script:
Local script

(This is just information about the code, and where it is)

If some can you help me with that, that be a big help. (I’m not that good at scripting)

1 Like

You can wrap the font color around the player’s name too.

Code:

-- Thank you to @Katrist for writing the script

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

local groupId = #### -- # Out Just Because

local tags = {
	[255] = "<font color='#F5CD30'>[⚡God]</font><font color='#F5CD30'> ",
	[254] = "<font color='#4287f5'>[🔨Developer]</font><font color='#F5CD30'> ",
	[253] = "<font color='#4287f5'>[🔨Developer]</font><font color='#F5CD30'> ",
	[214] = "<font color='#9c1df0'>[🛠️President]</font><font color='#F5CD30'> ",
	[212] = "<font color='#9c1df0'>[🛠️Head of Staff]</font><font color='#F5CD30'> ",
	[203] = "<font color='#2af0be'>[🌴Community manager]</font><font color='#F5CD30'> ",
	[202] = "<font color='#9b1df0'>[🛠️Admin]</font><font color='#F5CD30'> ",
	[200] = "<font color='#e1a9f5'>[🔧Moderator]</font><font color='#F5CD30'> ",
	[111] = "<font color='#83feec'>[🛠️Affiliate]</font><font color='#F5CD30'> ",
	[110] = "<font color='#ff8b07'>[🔥Partner]</font><font color='#F5CD30'> ",
	[101] = "<font color='#F5CD30'>[⭐️Supporter]</font><font color='#F5CD30'> ",
	[100] = "<font color='#63e848'>[✨Vip Dog]</font><font color='#F5CD30'> ",
}

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local props = Instance.new("TextChatMessageProperties")

	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		local rank = player:GetRankInGroup(groupId)

		if tags[rank] then
			props.PrefixText = tags[rank] .. message.PrefixText .."</font>"
		end
	end

	return props
end

My name is Katrist by the way, I appreciate the credit.

2 Likes

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