Need help with group chat tags

My code works:
image
I just checked it to make sure.

where would this go? in the tags script?

Check on the server side too, because I think your script is running on the server. Also, why can’t you test it in Studio?

idk how i’d test a group member if I am also the owner, it’d just give me the other tag I think

Just make a script called PlayerTags and put all the code in that script. (The script must be in ServerScriptService)

I think this might be because of your custom chat, Try it with normal chat.

the chat is just the normal chat with a different font

image

For me it works perfectly. Is the group id correct? Here are the scripts:
Script in ServerScriptService:

local ServerScriptService = script.Parent
local ChatServiceRunner = ServerScriptService:WaitForChild("ChatServiceRunner")
local ChatService = require(ChatServiceRunner:WaitForChild("ChatService"))

local Tags = require(script.Tags)

local function CheckForTags(Player)
	for i,Player in pairs(game.Players:GetChildren()) do
		if Player:IsInGroup(11804542) then -- My group (you should join)
			Tags[Player.Name] = {
				["TagText"] = "Group Member"; -- Replace with your text
				["TagColor"] = Color3.fromRGB(255,0,0) -- Replace with your color
			}
		end
	end
	local Attempt = Tags[Player.UserId] or Tags[Player.Name]

	if Attempt then
		local SpeakerObject

		repeat

			wait()

			SpeakerObject = ChatService:GetSpeaker(Player.Name)
		until SpeakerObject ~= nil

		SpeakerObject:SetExtraData("Tags", {Attempt})
	else
		print("No chat tags for "..Player.Name.."!")
	end
end

game.Players.PlayerAdded:Connect(function(Player)


	CheckForTags(Player)
end)

for _, Player in pairs(game.Players:GetPlayers()) do
	CheckForTags(Player)
end

Module Script:

local module = {
	["YT_Lemont"] = {
		["TagText"] = "🔨";
		["TagColor"] = Color3.fromRGB(255, 200, 0)
	};

	["Electroyzm"] = {
		["TagText"] = "🔨";
		["TagColor"] = Color3.fromRGB(255, 200, 0)
	};
}

return module
1 Like

that’s weird i’m almost 100% certain the group id was right, I copy and pasted from urs now lemme test again

If you want it to refer with a group use this:

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(GroupId)
   speaker:SetExtraData("Tags", {{TagText = 
players[player]:GetRoleInGroup(GroupId)}})
end)
1 Like

very strange now it works completely fine although now I have the issue of my main account getting the group member tag instead of the owner tag
image

Is the account that you are testing it on actually in the module list? I don’t see “BreX” in the module.

oh yeah I probably shoulda clarified yeah on my main acc it says group member too
image

Strange, I tested it in my place and the Owner tag takes priority
Maybe add if not table.find(Tags, Player.Name) then and it might work

where would this go in the script?

Below the for i,Player in pairs(game.Players:GetChildren()) do

hmm now there is no chat tag with my name

In your module, try adding

local module = {
	[game.CreatorId] = {
		["TagText"] = "🔨";
		["TagColor"] = Color3.fromRGB(255, 200, 0)
	};
}

And see if it works
Assuming you are the original game creator

the game is under a group I am the owner of, however these are underlined in red at the end
image

local ServerScriptService = script.Parent
local ChatServiceRunner = ServerScriptService:WaitForChild("ChatServiceRunner")
local ChatService = require(ChatServiceRunner:WaitForChild("ChatService"))

local Tags = require(script.Tags)

local function CheckForTags(Player)
	for i,Player in pairs(game.Players:GetChildren()) do
		if not table.find(Tags, Player.Name) then
		if Player:IsInGroup(13761066) then -- My group (you should join)
			Tags[Player.Name] = {
				["TagText"] = "Group Member"; -- Replace with your text
				["TagColor"] = Color3.fromRGB(255, 0, 0) -- Replace with your color
			}
		end
	end
	local Attempt = Tags[Player.UserId] or Tags[Player.Name]

	if Attempt then
		local SpeakerObject

		repeat

			wait()

			SpeakerObject = ChatService:GetSpeaker(Player.Name)
		until SpeakerObject ~= nil

		SpeakerObject:SetExtraData("Tags", {Attempt})
	else
		print("No chat tags for "..Player.Name.."!")
	end
end

game.Players.PlayerAdded:Connect(function(Player)


	CheckForTags(Player)
end)

for _, Player in pairs(game.Players:GetPlayers()) do
	CheckForTags(Player)
end