EDIT: Turns out the filter wasn’t functioning properly in studio, but works fine in-game. Thanks for the help!
I’m trying to make a system for players to display messages to the server when they donate a certain amount of Robux. For some reason, even obviously filtered words are passing through as accepted and being displayed. I’ve tried using filtering systems from other posts and modules, but nothing is working.
ClientEvent.OnServerEvent:Connect(function(player, action, message, amount)
if action == "FilterMessage" then
local success, result
local TextService = game:GetService("TextService")
success, result = pcall(function()
return TextService:FilterStringAsync(message, player.UserId)
end)
if success then
local filteredText = result:GetNonChatStringForBroadcastAsync()
if filteredText == "" or filteredText:match("^%*+$") then
ClientEvent:FireClient(player, "FilterResult", "Filtered", amount)
else
ClientEvent:FireClient(player, "FilterResult", "Accepted", amount)
NotifEvent:FireAllClients("server", filteredText, player, amount)
end
else
warn("Filtering failed:", result)
ClientEvent:FireClient(player, "FilterResult", "Filtered", amount)
end
end
end)