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

For a some reason even with people help filter won't work?

local function OnEvent(plr, text)
	
	local TextService = game:GetService("TextService")
	
	local successful, result = pcall(TextService.FilterStringAsync, TextService, text, plr)
	
	if successful then
		local result_success, filtered = pcall(result.GetNonChatStringForBroadcastAsync, result)
		
		name.Text = filtered
	end
	
	if not successful then
		name.Text = "#"
		print("Filter")
	end
end

It just always gives "#" (it just always gives NOT successful) for a some reason, I did looked on how to work with GetNonChatStringForBroadcastAsync and did something like that but looks like it won't work and always gives # (even with team test that allows filter api)

1 answer

✓ Accepted answer

That third parameter required by TextService:FilterStringAsync() is actually the player's UserId, not the player itself.

local successful, result = pcall(TextService.FilterStringAsync, TextService, text, plr.UserId)

It also might be wise to check for the success of that second pcall, as filtered may be nil if the call errors.

Another note: When the function inside of a pcall errors, that error message will be returned instead of your values. So you could print result if successful is false to see what the error was.

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