Text not being properly filtered

Hey devs,

Normally I don’t ask questions on here, as I like to learn the solution myself, but this particular case has me stumped; the text is not being properly filtered.

Below is the code that handles the filtering, but it doesn’t filter the text.

        local filteredTextResult = ""
		local result
		local success, errorMessage = pcall(function()
			result = textservice:FilterStringAsync(text,player.UserId,Enum.TextFilterContext.PublicChat)
		if success then
			filteredTextResult = result:GetNonChatStringForBroadcastAsync()
			for i = 1, #text  do
				filteredTextResult = filteredTextResult.."#"

For the line print(result), it prints ‘Instance’, and for the line print(filteredTextResult), it prints whatever the text is, however there doesn’t seem to be any filtering going on.

Also, please note that this is my first time coming across this module, and am not used to its methods and events.

Any idea what could be going wrong/what I can do to make this work?

Apologies for not formatting the code - I don’t have the time or patience to format it properly :sweat_smile:

All good: Text does get filtered, just not in studio - I had to try it out in game.

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