Chat Tag Prefix with New Chat

I’m using the new text chat system from here:

From scripting help servers I learned that the reason why my chat tag prefix isn’t working is because of the new chat, there’s no ChatServiceRunner in ServerScriptService anymore, which means my following code won’t work (there’s an error saying
Infinite yield possible on 'ServerScriptService:WaitForChild("ChatServiceRunner")' - Studio

Here is my server script in serverscriptstorage:

local Players = game:GetService("Players")
local service = game:GetService("MarketplaceService")
local gamepassId = 25949990
local developers = {"DinoViotto", "FizzyColas", "rvsita", "ashhchuu"}

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

	local Speaker = ChatService:GetSpeaker(player)
	for _, v in pairs(developers) do
		if Players[player].Name == v then
			Speaker:SetExtraData('Tags', {{TagText = "[🔨] [Developer]", TagColor = Color3.fromRGB(229, 212, 21)}}) 
	if service:UserOwnsGamePassAsync(player.UserId, gamepassId) then
		Speaker:SetExtraData('Tags', {{TagText = "[👑] [VIP]", TagColor = Color3.fromRGB(212, 175, 55)}})

so how can I make this script work with the new chat?
any help is appreciated! :slight_smile:

use richtext thing I don’t know what it’s called but here’s the creator doc

For the new chat, you need to assign a function to OnIncomingMessage, create a TextChatMessageProperties object, add tags to it using the .PrefixText property, and return it.

Check demos → Adding a VIP tag in this post:

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