How do i make tags for my freinds

Hi, so I’m trying to make tags for my friends but it seem the script doesn’t work

here’s the code

local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')

local ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

ChatService.SpeakerAdded:Connect(function(PlayerName)
	local Speaker = ChatService:GetSpeaker(PlayerName)
	if (Players[PlayerName].UserId == game.Friendid) then
		Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255))
		Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
		while wait()do
		
			Speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(255, 170, 0)}})
		end
	end
end)

let me know if there’s a problem with it

2 Likes

Hey, fundamentally you have done nothing wrong with how you are setting tags.

Your problem comes from line 8, where you run a check on a condition that does not exist within the environment. I assume that line’s purpose is to check whether or not you are friends with the provided Speaker. You would need to use Player:IsFriendsWith() instead.

I agree with the above, for using :IsFriendsWith()

Also why is there a while wait() do loop inside the SpeakerAdded? that isn’t necessary, and would only serve to reduce your game’s performance.

my bad for the while wait() loop oops

hey so i modify abit for the script and it still dont work
heres the script

local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')

local ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

ChatService.SpeakerAdded:Connect(function(PlayerName)
	local Speaker = ChatService:GetSpeaker(PlayerName)
	if (Players[PlayerName].UserId == game.Players:IsFriendsWith(223012675)) then
		Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255))
		Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
		Speaker:SetExtraData('Tags', {{TagText = 'Owners Friends', TagColor = Color3.fromRGB(0, 255, 0)}})
	end
end)

i did this and the script don’t work did i do somthing wrong

local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')

local ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

ChatService.SpeakerAdded:Connect(function(PlayerName)
	local Speaker = ChatService:GetSpeaker(PlayerName)
	if (Players[PlayerName]:IsFriendsWith(223012675) == game.Players:IsFriendsWith(223012675)) then
		Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255))
		Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
		Speaker:SetExtraData('Tags', {{TagText = 'Owners Friends', TagColor = Color3.fromRGB(0, 255, 0)}})
	end
end)