Example: You have 2 players chatting, and the 1st player has a nametag that says owner. If the 2nd player makes their message after that 1st player, their message will have the owner nametag too, AND their name in the chat will be the 1st player’s name.
Code:
local Properties = Instance.new('TextChatMessageProperties')
local tags = {
[150] = {TagText = "[Playtester]", TagColor = {255,255,0}},
[175] = {TagText = "[Admin]", TagColor = {0,0,255}},
[255] = {TagText = "[Owner]", TagColor = {200, 0, 0}},
}
TextChatService.OnIncomingMessage = (function(Message: TextChatMessage)
if Message.TextSource then
local player = game.Players:GetPlayerByUserId(Message.TextSource.UserId)
if player:IsInGroup(17246086) then
for i,v in pairs(tags) do
if player:GetRankInGroup(17246086) >= i then
Properties.PrefixText = "<font color='rgb(" .. v.TagColor[1] .. "," .. v.TagColor[2] .. "," .. v.TagColor[3] .. ")'>" .. v.TagText .. " </font>" .. Message.PrefixText
end
end
end
else
Properties.PrefixText = Message.PrefixText
end
return Properties
end)