Chat Tag Prefix with New Chat

I’m using the new text chat system from here: https://devforum.roblox.com/t/new-in-experience-text-chat-system-public-release/1848837

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)

ChatService.SpeakerAdded:Connect(function(player)
	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)}}) 
		end
	end
	if service:UserOwnsGamePassAsync(player.UserId, gamepassId) then
		Speaker:SetExtraData('Tags', {{TagText = "[👑] [VIP]", TagColor = Color3.fromRGB(212, 175, 55)}})
	end
end)

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

1 Like

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:

1 Like

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