How to make people with certain rank in a group have a chat tag

I want people with the Admin rank in my group to have an Admin tag in the chat

In the script I have I can only put in somebodies username and I don’t know what to change

1 Like

The code in your SpeakerAdded should be similar to this

local Speaker = ChatService:GetSpeaker(PlrName)
local Player = Players[PlrName]

if Player:GetRoleInGroup(groupId) == "Admin" then
	--Chat tag code
end

Where groupId is the id of your group, Chat tag code is basically that SetExtraData bit. If you want it to pick a specific rank number, Change GetRoleInGroup to GetRankInGroup and change "Admin" to the rank number belonging to the Admin rank

1 Like

I did that but it is not working when I use my alt

image

Firstly, remove the quotation marks from 253, secondly, it’s seeing a lot of things as nil

…Did you remove your entire code and replaced it with thing that I said which should only be in the SpeakerAdded event…?

I replaced it with what you said

Did you replace everything? The code was meant to go in the SpeakerAdded event as a replacement for this

image

I replaced everything so what part do I replace of this

local ServerScriptService = game:GetService(“ServerScriptService”)
local ChatService = require(ServerScriptService:WaitForChild(“ChatServiceRunner”):WaitForChild(“ChatService”))
local Players = game:GetService(“Players”)

local Owner = {‘HowToRobloxYT_TV’}

ChatService.SpeakerAdded:Connect(function(PlrName)
local Speaker = ChatService:GetSpeaker(PlrName)
for _, v in pairs(Owner) do
if Players[PlrName].Name == v then
Speaker:SetExtraData(‘Tags’, {{TagText = “Change this to whatever you want the chat tag to say. For example, Owner, Moderator, Builder.”, TagColor = Color3.fromRGB(255,0,0)}})
end
end
end)

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")

ChatService.SpeakerAdded:Connect(function(PlrName)
	local Speaker = ChatService:GetSpeaker(PlrName)
	local Player = Players[PlrName]

	if Player:GetRankInGroup(8638382) == 253 then
		Speaker:SetExtraData("Tags", {{TagText = "Admin", TagColor = Color3.fromRGB(255,0,0)}})
	end
end)

Thanks, I change the 253 for the other ranks and the TagText right?

Will different ranks have different tags? If so, please use a dictionary for that

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")

local tags = {
	[253] = {{TagText = "Admin", TagColor = Color3.fromRGB(255,0,0)}},
	[251] = {{TagText = "Guy", TagColor = Color3.fromRGB(0,255,255)}}
}

ChatService.SpeakerAdded:Connect(function(PlrName)
	local Speaker = ChatService:GetSpeaker(PlrName)
	local Player = Players[PlrName]
	local Tag = tags[Player:GetRankInGroup(8638382)]

	if Tag then
		Speaker:SetExtraData("Tags", Tag)
	end
end)
10 Likes

ok thanks this is a lot easier then needing to make a script for every admin and also it will let me make a tag for the fan rank

1 Like

it doesnt work with the new chat, can anyone help with tags in the new chat?