Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Roblox Text Filtering Function. How to extract message?

Hi, I've been recently trying to test and so some stuff with the filtering function from the text service however I have no idea on how can I get the content out from the filter

game.ReplicatedStorage.Chat.SendMessage.OnServerEvent:Connect(function(player, message)
	
	local success, result = pcall(function()
		return TextService:FilterStringAsync(message, player.UserId)
	end)
	
	if success then
		
		print(result)
	
	end
	
end)

Whenever I print the result it just gives me an Instance and I can't find anything about it's content within the Roblox wiki, how can I extract the message from it?

1 answer

✓ Accepted answer

The method FilterStringAsync of TextService returns a TextFilterResult Object. This Object contains it's own functions that allows you respectfully fit the filtered string for different cases.

In your case, you're looking for GetChatForUserAsync:

Result:GetChatForUserAsync(Player.UserId)
--// The argument supplied should correlate to the recipient's UserId.

This discussion is preserved as it was. New answers, comments, and votes are closed.