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