Issues with Text Being Filtered Resulting in game getting moderated

In result of text not being filtered correctly, ROBLOX took moderation action and resulted in our game to be taken out. Below is our main game chat system script with filtering system (I think). I wont include the variables from the events to keep our game secure and with hold security. However the only thing I just added was Enum.TextFilterContext.PublicChat in the end of the filter statement

Below is the two points we have with text input on our custom chat UI, one being a standard output for bubble text and another being a radio system where users text can be outputted onto.

If anyone has any ideas, if the message below is getting filtered correctly now and wont result in our game being held in ROBLOX Moderation.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local TextService = game:GetService("TextService")
local ChatService = game:GetService("Chat")

local MessageTabCreation = require(ReplicatedStorage.Modules.UI.Radio.MessageTabCreation)
local XPDataHelper = require(ReplicatedStorage.Modules.Shared.TeamXP.XP_DataStoreHelper)

local messageEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Radio"):WaitForChild("Message")
local TransmittingMessageEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Radio"):WaitForChild("TransmittingMessage")

local function getFilteredMessage(fromPlayer, text)
	local success, result = pcall(function()
		local TextFilterResult = TextService:FilterStringAsync(text, fromPlayer.UserId, Enum.TextFilterContext.PublicChat)
		return TextFilterResult:GetNonChatStringForBroadcastAsync()
	end)

	if success then
		return result
	else
		warn("Filter failed for player", fromPlayer.Name, ":", result)
		return string.rep("#", #text)
	end
end

TransmittingMessageEvent.OnServerEvent:Connect(function(player, status, callSignValue, deptShort, message, currentChannel)
	if status ~= "radiotransmit" then return end

	local filteredMessage = getFilteredMessage(player, message)
	local PlayerXP = player:WaitForChild("Leaderboardstats"):WaitForChild("XP_Folder"):WaitForChild("TeamXP").Value
	local PlayerRank = XPDataHelper.GetRank(PlayerXP):gsub("_", " ")

	TransmittingMessageEvent:FireAllClients("publishtest1", callSignValue, deptShort, filteredMessage, currentChannel, PlayerRank, player)
end)

messageEvent.OnServerEvent:Connect(function(player, status, message)
	if status ~= "standardtransmit" then return end

	local filteredMessage = getFilteredMessage(player, message)

	local character = player.Character or player.CharacterAdded:Wait()
	local head = character:FindFirstChild("Head") or character:WaitForChild("Head", 5)

	if head then
		ChatService:Chat(head, filteredMessage)
	else
		warn("Player's character head missing; cannot display chat bubble")
	end
end)

If its not this filter system above its probably another call point in the game. For example our callsign input

local function FilterCallsign(player, text)
	local success, result = pcall(function()
		return TextService:FilterStringAsync(text, player.UserId)
	end)
	if not success then return nil end

	local filtered
	success, filtered = pcall(function()
		return result:GetNonChatStringForBroadcastAsync()
	end)
	if not success then return nil end

	if filtered == "" then return nil end
	return filtered
end

If someone could help out it would be greatly appreciated

Your filtering is still incorrect in at least two places. Adding Enum.TextFilterContext.PublicChat fixed only one category. This can still trigger moderation. Every place user text is shown must be filtered with the correct context for how it is displayed. Using the wrong context counts as unfiltered text even if it passes through TextService. The radio text is filtered correctly, but bubble chat uses the wrong context and the callsign filter omits a required context, both of which are considered unfiltered by Roblox moderation.

Really two rules you need to remember everything else comes from them. Filtering depends on how the text is shown, not where it comes from. If the context does not match the display type, Roblox treats it as unfiltered even if it looks censored.

Keep this in mind.. Roblox moderation is automated. They scan live text paths. If one path outputs incorrectly filtered text. The whole game is flagged. It don’t matter if 99 percent is correct.

Ah ok, so for the first script would you separate out the filter to be one for standard chat and one for chat displaying on UI? As well i have a admin system with 0 filtering, would you suggest adding filtering to that as well?

“Chat” isn’t a valid option only private chat or public chat. Therefore I am guessing PublicChat is the correct one

(post deleted by author)

They the filters would become?

Just asking for help buddy since I am new to this type of field

Your chat system cannot be using GetNonChatStringForBroadcastAsync to filter chat messages. Your chat system must make use of TextChatService

Create a TextChannel for your radio channel under the TextChatService service

You can then call TextChannel:SendAsync(Message, Metadata) on the client which is sent to the server and automatically filtered.

This filtered result is automatically sent to all clients who can access the TextChannel and the filtered result can be received using TextChannel.MessageReceived.

The metadata can be received from the MessageReceived TextChatMessage instance.

If this is just using the global chat for transmitting messages, you can just use SendAsync and MessageReceived on “RBXGeneral”. Pass a metadata through SendAsync with a radio transmitting identifier which can be read in MessageReceived.

Enum.TextFilterContext.Chat and GetChatStringForBroadcastAsync do not exist in the engine API. Where are you getting this?

omg yes thank you so much. This makes so much more sense, thank you

(post deleted by author)

GetNonChatStringForBroadcastAsync cannot be used for chat bubbles and will result in the experience being moderated. It can only be used exclusively for non-chat systems such as pet names.

Per the API, GetNonChatStringForBroadcastAsync can only be used for non-chat contexts.

I do not understand why you are being rude.

One last thing if you don’t mind me asking. If they’re not transmitting I am guessing to just send to through the standard bubble text?

ChatService:Chat on the client will only locally display the BubbleChat. May I see where this chat is being inputted? Is the radio and normal chat going through the same TextBox?

Yeah same chat box

Replace ChatService:Chat with just TextChatService.TextChannels.RBXGeneral:SendAsync(ChatBox.Text)

This will just send it through to the default roblox global channel

“RBXGeneral is not a valid member of TextChatService “TextChatService”” Tried it and got this in the console

My bad, its TextChatService.TextChannels.RBXGeneral
I edited my post above to correct it

Yeah works, thanks last last thing so sorry. For receiving the message from the channel would you do something like this,

msg.Sender does not exist in TextChatMessage (you might have misunderstood how metadata works, which only accepts a string and is meant for message identifiers, not identifying players)

Use msg.TextSource.UserId and fetch the sender’s player object with Players:GetPlayerByUserId()