Chat messages aren't showing with textchatservice

Hello. I have been trying to make chat tags using textchatservice, but when someone else types something, everyone else doesn’t see the message. Here is my code.

local TextChatService = game:GetService("TextChatService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Modules = ReplicatedStorage:WaitForChild("Modules")

local GamepassModule = require(Modules:WaitForChild("GamepassModule"))

local chatTags = {
	["VIP"] = {
		["Tag"] = "VIP",
		["Color"] = {
			["r"] = 255,
			["g"] = 255,
			["b"] = 0,
		}
	}
}

local function applyChatTagColor(name)
	local tagTable = chatTags[name]
	
	if tagTable then
		return tagTable.Color.r, tagTable.Color.g, tagTable.Color.b
	end
end

TextChatService.OnIncomingMessage = function(Message: TextChatMessage)
	local Properties = Instance.new("TextChatMessageProperties")
	
	if Message.TextSource then
		local Player = game:GetService("Players"):GetPlayerByUserId(Message.TextSource.UserId)
		
		if GamepassModule.UserownsGamepass(Player, "VIP") then
			local r, g, b = applyChatTagColor("VIP")
			
			Properties.PrefixText = "<font color='rgb(" .. r .. "," .. g .. "," .. b .. ")'>" .. "[VIP]" .. "</font> " .. Message.PrefixText
		end
	end
	
	return Properties
end
3 Likes

are you sure the chatversion is set to legacy?

If not go to game.TextChatService.ChatVersion and set it to “LegacyChatVersion” in properties

1 Like

I tested this without the Gamepass checking and modules you have, as I don’t know what it consists of, but this works.

Are you using custom TextChannels? If you are, make sure you are adding each player to that TextChannel using :AddUserAsync().

On top of that, make sure the Client is targeting the TextChannel you want them to be typing in, by changing the “TargetTextChannel” property under TextChatService.

If this isn’t the solution, I recommend taking a look at your “GamepassModule”, as like I said previously, this code you have here works, if you exclude the “GamepassModule” part.

1 Like

I am not using any custom text channels, just the default textchatservice. Also the gamepass module is just checking if you own any gamepasses

1 Like

As previously stated, it works without the Gamepass Module. I am not sure if players can check if other players have a Gamepass in an Experience, but I would recommend checking that module, as that’s where the problem seems to be. Roblox also has documentation on adding this exact feature, though they use Attributes.

1 Like

Ah, so you are saying the client cant check if other players have a gamepass, therefor it never gets to the return properties?

1 Like

That’s a possibility. As I said, I am not quite 100% on that, but I suggest removing that part and seeing if you can see other player messages(you can just local server test), just to ensure/narrow down the problem.

1 Like

@Carlsensuperstjerne To send custom messages you need to have legacychatservice enabled, and I’m not sure there’s any other way to do it.

This is untrue. While you can make custom messages with LegacyChat System, you can also do it with the new version, TextChatService. It’s even recommended to use TextChatService as LegacyChat is deprecated as stated at the top.