hey my question is can u give me a script of the chat tags for the new TextChatService but the one that i could give more than 1 rank of group members i wanna make it give a certain chat tag for each role in my group please
This is a decently outdated video but I think I can help you.
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local GroupId = 12345678 -- Replace with your group ID
-- Dictionary mapping role IDs to tags
local roleTags = {
[123] = "<font color='#a50000'>[Admin]</font>", -- Replace 123 with actual role ID
[456] = "<font color='#00a500'>[Moderator]</font>", -- Replace 456 with actual role ID
[789] = "<font color='#0000a5'>[Member]</font>" -- Replace 789 with actual role ID
}
TextChatService.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local role = player:GetRoleInGroup(GroupId)
for roleId, tag in pairs(roleTags) do
if role == roleId then
properties.PrefixText = tag .. " " .. message.PrefixText
break
end
end
end
end
return properties
end
If this works please mark this message as the answer/solution.
Oh wait lol your talking about it because roblox updated the chat ok hold up i’ll try to edit this.
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local GroupId = 12345678 -- Replace with your group ID
-- Dictionary mapping role IDs to tags
local roleTags = {
[1] = "<font color='#a50000'>[Admin]</font>", -- Replace 1 with actual role ID for Admin
[2] = "<font color='#00a500'>[Moderator]</font>", -- Replace 2 with actual role ID for Moderator
[3] = "<font color='#0000a5'>[Member]</font>" -- Replace 3 with actual role ID for Member
}
TextChatService.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local role = player:GetRoleInGroup(GroupId)
for roleId, tag in pairs(roleTags) do
if role == roleId then
properties.PrefixText = tag .. " " .. message.PrefixText
break
end
end
end
end
return properties
end
did this and still doesnt work pls make sure ur doing it with the new chat the TextchatService not the legacy
you get any errors by chance? check console and send me a ss
try it in the game its self not roblox studio.
what the errors or try what
I don’t see any errors I can try to re-do the code but first join the game itself like join it on the Roblox client not Roblox Studio
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local GroupId = 12345678 -- Replace with your group ID
-- Dictionary mapping role IDs to tags
local roleTags = {
[1] = "<font color='#a50000'>[Admin]</font>", -- Replace 1 with actual role ID for Admin
[2] = "<font color='#00a500'>[Moderator]</font>", -- Replace 2 with actual role ID for Moderator
[3] = "<font color='#0000a5'>[Member]</font>" -- Replace 3 with actual role ID for Member
}
-- Function to get the tag based on the player's role in the group
local function getTagForPlayer(player)
local role = player:GetRoleInGroup(GroupId)
for roleId, tag in pairs(roleTags) do
if role == roleId then
return tag
end
end
return nil
end
TextChatService.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local tag = getTagForPlayer(player)
if tag then
properties.PrefixText = tag .. " " .. message.PrefixText
end
end
end
return properties
end
maybe this could help so look this is a code for the new textchatservice and it works but its using usernames yk i need it for group ranks
copy and paste the code and send it here and i will fix it rq for you
local TextChatService = game:GetService(“TextChatService”)
local Players = game:GetService(“Players”)
local GroupId = 33405200 – Replace with your group ID
– Dictionary mapping role IDs to tags
local roleTags = {
[255] = “[Owner ]”, – Replace 123 with actual role ID
[254] = “[Co-Owner ]”, – Replace 456 with actual role ID
[253] = “[Council ]” – Replace 789 with actual role ID
[251] = “[Developer ]” – Replace 789 with actual role ID
[250] = “[Operative ]” – Replace 789 with actual role ID
[10] = “[Staff ]” – Replace 789 with actual role ID
[7] = “[Donor ]” – Replace 789 with actual role ID
}
TextChatService.OnIncomingMessage = function(message)
local properties = Instance.new(“TextChatMessageProperties”)
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local role = player:GetRoleInGroup(GroupId)
for roleId, tag in pairs(roleTags) do
if role == roleId then
properties.PrefixText = tag .. " " .. message.PrefixText
break
end
end
end
end
return properties
end
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local GroupId = 33405200
-- Dictionary mapping role IDs to tags
local roleTags = {
[255] = "[Owner ]",
[254] = "[Co-Owner :crown:]",
[253] = "[Council :balance_scale:]",
[251] = "[Developer :hammer_and_wrench:]",
[250] = "[Operative :shield:]",
[10] = "[Staff :beginner:]",
[7] = "[Donor :gem:]"
}
TextChatService.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local role = player:GetRoleInGroup(GroupId)
for roleId, tag in pairs(roleTags) do
if role == roleId then
properties.PrefixText = tag .. " " .. message.PrefixText
break
end
end
end
end
return properties
end
should this be in a script or local script and where should it be?
Local should work. If not lmk.
yeah still doesnt work smh and yes its local script putten in startergui
Just noticed it 2:40 am for me i will be able to rethink this when I’m up in the morning I am also coding on my phone so they doesn’t help lol