Chat filtering - goes through the system but returns as unfiltered

I looked up at some of the documentation and did it the exact way it’s supposed to do it as.

However, when I test it in Studio, it tends to return curse words unfiltered rather than filtered.

I’d try this in my actual personal game, but knowing how strict they are with chat filtering, I’m a bit concerned about getting a strike.

Is this properly written?

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if player.Character:FindFirstChild("Microphone") then
			local filteredtext = ""
			local success, errormsg = pcall(function()
				local TextService = game:GetService("TextService")
				local object = TextService:FilterStringAsync(msg, player.UserId)
				filteredtext = object:GetNonChatStringForBroadcastAsync()
			end)
			if success then
				print(filteredtext)
			else
				print("ew")
			end
		end
	end)
end)

Text isn’t filtered in studio, it’s a weird convention but I assume it’s to reduce the amount of requests issued to Roblox’s text filtering service.

1 Like