TextChatService ChatTags working locally

Issue:
Players aren’t able to see others their messages, only their own and that of the system itself.

tried fixing it?
Yes i have, i tried putting the settings on the message itself instead of the properties but when i did that players got an error message “Could not send your message” and in the chat logs it would show the HTML code. I tried looking at other posts but didnt see anything different with my code and theirs fundamentally…

What am i trying to create?
I want to make chat tags for players based on their Team, Gamepasses, UserID and GroupRank. (The configuration is inside the module script called “ChatFormatting”)

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local ChatFormatting = require(script:WaitForChild("ChatFormatting"))

local function GetAuthor(UserId)
	for _, Player in pairs(Players:GetPlayers()) do
		if Player.UserId == UserId then
			return Player
		end
	end
end

Players.PlayerAdded:Connect(function(plr)
	if plr.UserId ~= game.CreatorId then -- Don't show a join message when the owner joins
		if not Players.LocalPlayer:IsFriendsWith(plr.UserId) then -- Don't show a join message when your friend joins (Roblox has this built-in)
			TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(string.format("%s has joined the game.", plr.DisplayName))
		end
	end
end)

TextChatService.OnIncomingMessage = function(msg)
	local properties = Instance.new("TextChatMessageProperties")

	if msg.TextSource then -- Player Message
		local plr = GetAuthor(msg.TextSource.UserId)
		if plr then
			local prefixText, formattedMessage = ChatFormatting.formatMessage(plr, msg)
			properties.PrefixText = prefixText .. (properties.PrefixText or "")
			properties.Text = formattedMessage
			return properties
		end
	else -- System Message
		local textSize = 17
		properties.Text = string.format("<font color='%s' size='%d'><b><i> {Incantus System} %s</i></b></font>", ChatFormatting.SystemChatColor, textSize, msg.Text)
		return properties
	end
end

If you think the issue is in the module script i’ll be happy to send it. For now i wont because there is no reason to share my whole system without a good reason.

1 Like

I fixed it by checking what a player needs as chat tags on the server side!

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