Changing chat tags

Hello, I’ve been trying to change my chat tags to the new chat system. I haven’t been able to figure it out so now I need some help.

Code

function tag(rank, name, tagc, namec, chatc)
	local groupid = ####### -- Group ID -- Taged out because it is easier.
	local GamepassId = 103349116 --The gamepass ID
	local MarketplaceService = game:GetService("MarketplaceService") --MarketplaceService
game.Players.PlayerAdded:Connect(function(player)

		if player:IsInGroup(groupid) then
			if player:GetRankInGroup(groupid) == rank then
		local tags = {
			{
				TagText = name, -- Tag
				TagColor = tagc -- Member tag Color	
			}
		}
		local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
		local speaker = nil
		while speaker == nil do
			speaker = ChatService:GetSpeaker(player.Name)
			if speaker ~= nil then break end
			wait(0.01)
		end
		speaker:SetExtraData("Tags",tags)
				speaker:SetExtraData('NameColor', namec)
				speaker:SetExtraData("ChatColor",chatc) -- Text Color
			end
		end
	end)
end

Color3.fromRGB(42, 240, 189), Color3.fromRGB(204, 255, 231))
tag(100, "✨Vip Dog", Color3.fromRGB(119, 237, 72), Color3.fromRGB(179, 182, 183), Color3.fromRGB(255, 255, 255))
tag(101, "⭐️Supporter", Color3.fromRGB(234, 231, 1), Color3.fromRGB(179, 182, 183), Color3.fromRGB(255, 255, 255))
tag(110, "🔥Partner", Color3.fromRGB(255, 140, 7), Color3.fromRGB(255, 213, 7), Color3.fromRGB(255, 255, 255))
tag(111, "🛠️Affiliate", Color3.fromRGB(131, 254, 236), Color3.fromRGB(179, 182, 183), Color3.fromRGB(255, 255, 255))
tag(200, "🔧Moderator", Color3.fromRGB(225, 169, 245), Color3.fromRGB(179, 182, 183), Color3.fromRGB(216, 193, 229))
tag(202, "🛠️Admin", Color3.fromRGB(155, 29, 240), Color3.fromRGB(179, 182, 183), Color3.fromRGB(216, 193, 229))
tag(203, "🌴Community manager", Color3.fromRGB(42, 240, 189), Color3.fromRGB(42, 240, 189), Color3.fromRGB(204, 255, 231))
tag(212, "🛠️Head of Staff", Color3.fromRGB(155, 29, 240), Color3.fromRGB(179, 182, 183), Color3.fromRGB(216, 193, 229))
tag(214, "🛠️President", Color3.fromRGB(155, 29, 240), Color3.fromRGB(179, 182, 183), Color3.fromRGB(216, 193, 229))
tag(253, "🔨Developer", Color3.fromRGB(255, 38, 0),Color3.fromRGB(43, 131, 255), Color3.fromRGB(255, 81, 26))
tag(254, "🔨Developer", Color3.fromRGB(255, 38, 0),Color3.fromRGB(43, 131, 255), Color3.fromRGB(255, 81, 26))
tag(255, "⚡God", Color3.fromRGB(255, 251, 0),Color3.fromRGB(255, 64, 255), Color3.fromRGB(210, 203, 94))

So all I need is it to be changed and that would help a lot.

Your script is using the old chat service.

Add a new LocalScript in StarterPlayerScripts and paste this inside:

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

local groupId = 0000000

local tags = {
	[200] = "<font color='#4287f5'>[Cool]</font>",
	[255] = "<font color='#F5CD30'>[VIP]</font>",
	-- Add more
}

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

Just to let you know, I added something in your favor:

-- Thank you too @Katris for Writing the script
1 Like

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