Hello. I was developing a new update (that included the help of a topic i posted like 4h ago), and realized I cannot change the group chat tag color. It just stays at purple, and there is no way of changing it.
Script:
local players = game:GetService("Players")
local serverScriptService = game:GetService("ServerScriptService")
local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
chatService.SpeakerAdded:Connect(function(Player)
local speaker = chatService:GetSpeaker(Player)
players[Player]:IsInGroup(10970406)
speaker:SetExtraData("Tags",{{TagText = players[Player]:GetRoleInGroup(10970406)}})
end)
I kinda rewrote it (more like just blatantly rewrote it) and so what this does is validate your group presence and if you are a member then you will be given a named role if it is available. this will set all tags if there are any available
local players = game:GetService("Players") :: Players
local serverscriptservice = game:GetService("ServerScriptService") :: ServerScriptService
local chatservice = require(serverscriptservice:WaitForchild("ChatServiceRunner"):WaitForChild("ChatService"))
chatservice.SpeakerAdded:Connect(function(player: Player)
local speaker = chatservice:GetSpeaker(player)
local tags = {}
local playerValidated, playerIsInGroup = pcall(player.IsInGroup, player, 10970406)
if playerValidated and playerIsInGroup then
local validatedRole, roleName = pcall(player.GetRoleInGroup, player, 10970406)
if validatedRole then
table.insert(tags, {
TagText = roleName:sub(1, 20) -- you can set max text length for tags (i suggest it)
})
end
end
if table.getn(tags) > 0 then
speaker:SetExtraData('Tags', tags)
end
end)
It’s been a minute since I changed colors you do use color tho that’s how you change the color you list the variable and then do new color and then the comor
OH LOL my bad I mean the code kinda looks like it was gonna error because idk what players[player] is supposed to be when you already have a service and a function that provides the players (but I know now to read the post twice before posting lol) I mean I hope the code helps but I’m pretty sure it’s TagColor they’re looking for
However with lol XD that will be the Name of the tag I’m on pretty sure so you would need to name thst Developer or Owner whatever you want. It does depend on script though. So try both
Ok, I have to rewrite the whole script just for the group chat tag color.
local groupid = 10970406 -- Group ID
game.Players.PlayerAdded:Connect(function(player)
if player:IsInGroup(groupid) then
local tags = {
{
TagText = (player:GetRoleInGroup(groupid)), -- Tag
TagColor = Color3.fromRGB(255, 229, 33) -- Member tag Color
}
}
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
local speaker = nil
while speaker == nil do
speaker = ChatService:GetSpeaker(player.Name)
if speaker ~= nil then break end
wait(0.01)
end
speaker:SetExtraData("Tags",tags)
speaker:SetExtraData("ChatColor",Color3.fromRGB(255, 255, 255)) -- Text Color
end
end)