How do I add a Gamepass chat tag to this group chat tag script?

Hello, I need help adding a Gamepass chat tag to this group chat tag script so it shows like [Group] [Gamepass] [Player]: Hello!

I’m not sure on how I could implement that. Help or suggestions are appreciated.

local groupid = 16652085 -- groupID --- your group id 
local noTag = {1} -- inbetween the braces add your userid or whoever you dont want to show the tags

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(groupid) then
		local tags = {
			{
				TagText = (player:GetRoleInGroup(groupid)), -- Do not change
				TagColor = Color3.fromRGB(0, 255, 255) -- Group Role 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
		if not table.find(noTag, player.UserId) then
			speaker:SetExtraData("Tags",tags)
			speaker:SetExtraData("ChatColor",Color3.fromRGB(255, 170, 0)) -- Group Chat Color
			else
		end
		end
end)

Are you wanting to add multiple tags or just change the tag if they have a gamepass?

Either way, you’ll want to use UserOwnsGamePassAsync.

I want to add multiple tags to the script

I would need to see what that module does as speaker:SetExtraData() isn’t defined in the script you sent.

Use UserOwnsGamePassAsync. If the player owns the gamepass and is in the group, you can set it to this.

TagText = (player:GetRoleInGroup(groupid).. gamepassName)

If the player owns the gamepass but is not in the group, set the TagText to only the gamepass name.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.