GetChatForUserAsync is not failing, but returning "" on any string given

Our messaging system in our game is not working as intended due to a ROBLOX issue, causing text to be lost before and after transit because of the filtering that we do.

It doesn’t error at all, it just returns “” only.

So far this is consistent, I have grabbed the filtering code from the main game and put it into one of my places for testing, and it’s produced the same results

image

To be clear this method is partially deprecated, but ONLY on the client. We do not filter on the clientside, this is all server code.

local stringtofilter = "testing"

local ts = game:GetService("TextService")


local function getTextObject(message, fromPlayerId)
	local textObject
	local success, errorMessage = pcall(function()
		textObject = ts:FilterStringAsync(message, fromPlayerId)
	end)
	if success then
		return textObject
	end
	return false
end

local function getFilteredMessage(textObject, toPlayerId)
	local filteredMessage
	local success, errorMessage = pcall(function()
		filteredMessage = textObject:GetChatForUserAsync(toPlayerId)
	end)
	if success then
		return filteredMessage
	end
	return false
end

task.wait(3)
local userid = game.Players:GetPlayers()[1].UserId
local TextObject = getTextObject(stringtofilter,userid)
print(TextObject)
local FilteredString = getFilteredMessage(TextObject,userid)
print(FilteredString)

Hello and thank you for the report! This is expected behavior as this function is being deprecated with the migration to TCS, as per TextService Filtering returns empty message for valid text input - #18 by rbitia_rbx. We will have the documentation updated specifying that this is the case soon.

To close this off, here is the updated documentation for TextFilterResult:GetChatForUserAsync, which now includes deprecation messaging: TextFilterResult | Documentation - Roblox Creator Hub

For more information on how to migrate to TextChatService, feel free to reference this guide: Text chat overview | Documentation - Roblox Creator Hub

1 Like

Hi just to say, that disclaimer is kind of incorrect, it’s also doing the same thing on the server. So its deprecated on both server and client.

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