Limby
1
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
the vid: https://www.youtube.com/watch?v=r2IY1-Wag4w&t=231s
nyx
2
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.
@Limby
nyx
3
Oh wait lol your talking about it because roblox updated the chat ok hold up i’ll try to edit this.
nyx
4
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
@Limby
Limby
5
did this and still doesnt work pls make sure ur doing it with the new chat the TextchatService not the legacy
nyx
6
you get any errors by chance? check console and send me a ss
nyx
8
try it in the game its self not roblox studio.
Limby
9
what the errors or try what
nyx
10
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
Limby
11
yeah still doesnt work i published and tried it ingame
nyx
12
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
Limby
13
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
nyx
14
copy and paste the code and send it here and i will fix it rq for you
Limby
15
nyx
16
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
Limby
17
should this be in a script or local script and where should it be?
nyx
18
Local should work. If not lmk.
Limby
19
yeah still doesnt work smh and yes its local script putten in startergui
nyx
20
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