Help fixing my TextChatService chat tag

Hello i need help fixing my TextChatService chat tag i can not add rank that work, here is the code:

function setupChatTag(Rank, tagtext, tagcolor, namecolor, textcolor)
	local function generateChatTag(text, colour, namecolour)
		return '<font color="'..colour..'">'..'<font size="17">'..'<font face="FredokaOne">'..'<font color="'..namecolour..'">'..text..'</font>'..'</font>'..'</font>'..'</font>'
	end

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

	TextChatService.OnIncomingMessage = function(message)
		local Properties = Instance.new("TextChatMessageProperties")
		Properties.Text = '<font size="17"><font color="'..textcolor..'"><font face="FredokaOne">'..message.Text..'</font></font></font>'

		if message.TextSource then
			local Player = Players:GetPlayerByUserId(message.TextSource.UserId)

			if Player:GetRankInGroup(9508756) == Rank then
				Properties.PrefixText = generateChatTag(tagtext.." ["..message.PrefixText.."]", "#b3b6b7", "#b3b6b7")
			else
				Properties.PrefixText = generateChatTag(message.PrefixText, namecolor, namecolor)
			end
		end

		return Properties
	end
end


setupChatTag(1, "[Staff]", "#fffb00", "#ff40ff", "#d2ca5e")

It goes in starter player scripts

Are there any errors, or anything like that?

1 Like

There is a bug where the color of the tag will be the name of the player.

When I run the script on the server, this is what happens.

Are you using a script, or a local script?

1 Like

Yes starter player scripts. Do you have any more question?
Local script.

Alright, right here.
image

The rank your setting is “1”, in your group, your not the rank 1.
I recommend changing it to something else, or using another operator.

Oh I gave you one I forgot to change it I was testing what it look like without it it still does not work

For me, it shows this in the chat
image

Can I see what it shows you in the chat?

Can you fix it? Let me know. By the way there is a bug for me the name color will not change.

You deleted this post btw.


This is due to you setting the colors to the same value. “#b3b6b7

1 Like

Can you fix it, and try it after

That is for if you are not staff