This script works on LegacyChatService, but I want to use the new chat system TextChatService. However my script doesn’t work after I switched.
local gamepassId = 112579003 -- Gamepass ID
local service = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
local tags = {
{
TagText = "VIP+", -- Tag
TagColor = Color3.fromRGB(255, 215, 17) -- VIP Color
}
}
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
local speaker = nil
while speaker == nil do
speaker = ChatService:GetSpeaker(player.Name)
if speaker ~= nil then break end
wait(0.01)
end
speaker:SetExtraData("Tags",tags)
speaker:SetExtraData("ChatColor",Color3.fromRGB(255, 252, 156)) -- Text Color
end
end)
local TextChatService = game:GetService("TextChatService")
local marketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamepassID = 112579003
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local props = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if marketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassID) then
props.PrefixText = "<font color='#F5CD30'>[VIP]</font> " .. message.PrefixText
end
end
return props
end
This LocalScript updates your chat tag if you own a gamepass