TextService Filtering returns empty message for valid text input

When using TextService followed by GetChatForUserAsync on the returned object, the function returns an empty string instead of the filtered message content. This occurs both in Roblox Studio and in published games.

Create a script in ServerScriptService with the following code:

local TextService = game:GetService("TextService")
local Players = game:GetService("Players")

-- Wait for a player to join to test with
local function testFilter()
    local player = Players:GetPlayers()[1]
    if not player then
        print("Waiting for a player to join...")
        task.wait(2)
        return testFilter()
    end

    local userId = player.UserId
    local testMessage = "Hello world! This is a test message 123"

    print("Original message:", testMessage)

    local success, filteredResult = pcall(function()
        local filteredTextObject = TextService:FilterStringAsync(testMessage, userId, Enum.TextFilterContext.PublicChat)
        return filteredTextObject:GetChatForUserAsync(userId)
    end)

    if success then
        print("Filtered message:", filteredResult)
    else
        print("Filtering failed with error:", filteredResult)
    end
end

-- Run the test
testFilter()

Actual result: The filtered message is empty, as shown in the console output:

Original message: Hello world! This is a test message 123  
Filtered message:

This happens when I publish this script to any experience, group or otherwise. This also fails even in studio after publishing to a place, which is odd because filtering shouldn’t occur in studio from my experience.

here is a test place file that you should publish and then test to see the same result:
filter-test.rbxl (55.4 KB)

Expected behavior

Expected result: The filtered message should be displayed in the console and match the original input (since it contains no inappropriate content).

A private message is associated with this bug report

31 Likes

2 Likes

Can confirm this is happening, all of my user-input strings are being eaten including my friend’s custom tag (which you can see up top there)

3 Likes

Update on the bug:

filteredString = filteredResult:GetNonChatStringForUserAsync(userId)

works

filteredString = filteredResult:GetChatForUserAsync(userId)

is the one that fails and returns an empty string

The issue is occuring across multiple games now, slowly spreading to those larger and larger. It’s becoming a more spread issue where even messages thare not being directly filtered are not being sent - including via the chat bubble and the chat box. It’s affecting games to the point their unplayable if you require the chat filter/service for example within roleplay games (namely ER:LC etc) you are unable to communicate with others in regards to roleplay messages - including the radios and other in-game aspects considering messages are returning a chat filter error. An error is additionally logged in console on the client namely stating:

Failed to translate string with key: InGame.ConnectioNError.DisconnectCLientRequest

Stack Begin
Script 'CoreGui.RobloxGui.CoreScripts/AppChatMain'', Line 18
Stack End

Happening in my experiences as well hopefully there’s a response soon

1 Like

We can’t filter texts using TextService and ChatService since they took it away. This is going to break every game with message systems such as commands, dialogues, and many more.

Had this occur with a groups various different experiences yesterday, basically around the time they said they where finally migrating places to TextChatService.

1 Like

wait what, what do we filter with then?

Chat was deprecated, but I don’t think TextService was (the docs don’t show it), since TextService is separate from the chat system.

Also noticed this, and even swapping from Chat filtering to TextService filtering didn’t fix it. I had to swap over to bubble chat temporarily just so basic chat functionality works.
(How do you mess up this badly???)

1 Like

GetChatForUserAsync has been partially deprecated and now will return an empty string when called from the client.

ā€˜Text filtering pertaining to chat should be done through TextChatService and experiences that do not properly filter player-generated chat text might be subject to moderation.’

2 Likes

TextChatService does not provide anything explicitly to filter a string, how are we supposed to make custom chats work or even migrate them?

TextChatService filters messages automatically upon replication, as shown in this post:


I’m not sure whether you can access the per-user filtered string anymore, but you definitely can from the clients, so you might have to rethink the logic a bit.

1 Like

Filtering is returning empty strings even on the server fyi

1 Like

GetChatForUserAsync is being deprecated as part of the migration to TCS. TextChatService handles filtering for you for chat, so you don’t need this API anymore. The other APIs, GetNonChatStringForBroadcastAsync and GetNonChatStringForUserAsync are still supported.

We will making the deprecation warning more clear in documentation. TextFilterResult | Documentation - Roblox Creator Hub

1 Like

The deprecation warning was very subtle for such a damaging change. Is there any way we can access the filtering system or store results in single instances like we did before? This makes it hard to have systems where chatting history is saved by the server and then deployed to clients based on their filtering settings.

1 Like

Features for persisting chat history and having them available to clients is something we want to support in the future.

Is there any solution in the meanwhile? Like making the TextChatService filter available for use on the server?

4 Likes

GetNonChatStringForBroadcastAsync literally has ā€œNonChatā€ in its name this isn’t meant to be used for custom chat systems.

After looking further I did find a ā€œtutorialā€ about this

but for all things holy, why is it so over complicated? A single function allowing for text filtering between two users would be literally all you need. If I have a global chat system on the server using .chatted for example, I now have to go research like 8 different instances and functions just to have the same functionality.

Literally trying to convert it as I’m typing this and it feels like the 12 labors of Hercules just to understand basic functionality, it’s been like 30 minutes and I’m only now getting the server to pick up on a single message using the new systems. Furthermore it’s such a pain to work with that if I want my current code to work well with the new system I have to scrap large portions of it. It might be easier to just plug into GetNonChatStringForBroadcastAsync regardless.

TL;DR if I’m getting this right, not a bug but just intentionally made harder to use for the gain of ā€œparental control and community standardsā€, with the only alternatives for custom chat requiring excessive work for re-implementation.

EDIT; After looking at some other posts as well, I think it’s meant to replace basic chat but the functionality required to replace higher end systems such as custom chats isn’t really easily there, especially getting that info on the server, unless I’m forced to I really see no point in attempting to completely convert to TextChatService when it has so many more downsides in terms of converting older systems that just using GetNonChatStringForBroadcastAsync can do 100x easier.

3 Likes