ChatTag Error in output

local gamepassId = 154681540
local service = game:GetService("MarketplaceService")
local tagColor_ = Color3.fromRGB(255, 170, 127)
local chatColor_ = Color3.fromRGB(255, 170, 127)

local function onPlayerAdded(player)
    if service:UserOwnsGamePassAsync(player.UserId, gamepassId) then
        local tags = {
            {
                TagText = "⭐", -- Tag
                TagColor = tagColor_
            }
        }
        local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
        local speaker = ChatService:GetSpeaker(player.Name)
        speaker:SetExtraData("Tags", tags)
        speaker:SetExtraData("ChatColor", chatColor_) -- Text Color
    end
end

game.Players.PlayerAdded:Connect(onPlayerAdded)

I keep getting this error “Infinite yield possible on 'ServerScriptService:WaitForChild(“ChatServiceRunner”)”, how do I fix it?

1 Like

I do have a WaitForChild in that line.

Is your game using the new TextChatService?

Yes it should be, is there something wrong with that?

TextChatService doesn’t utilize ChatServiceRunner or the older chat system mechanics; Your code is only compatible with the legacy chat system

I recommend using the TextChatService.OnIncomingMessage callback to add chat tags.