I’m trying to write some code that enables anyone on the developer’s friends list to have a chat tag. (That way my friends are encouraged to play my game!)
After some experimenting, I haven’t been able to do this! Is there a problem with my code?
Script in ServerScriptService:
local players = game:GetService("Players")
local chatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local friendtags = {
{TagText = "friends w dev",TagColor = Color3.fromRGB(121, 123, 255)},
}
chatService.SpeakerAdded:Connect(function(playerName)
local speaker = chatService:GetSpeaker(playerName)
local player = game.Players[playerName]
if player:IsFriendsWith(game.CreatorId) then
speaker:SetExtraData("Tags", {friendtags[player.UserId]})
end
end)