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)