A module designed to filter text beyond standard chat functionalities.
Why should I use?
Some people reported that they cannot use the normal FilterStringAsync if the chat is disabled, so this module will be useful for those cases.
How to Setup
Insert the module anywhere in your game (Ex. Replicated Storage)
Usage
Server Script:
-- Path to the module
local Module = require(game.ReplicatedStorage.FilteringModule)
game.Players.PlayerAdded:Connect(function(Player)
local Text = "Fuc!"
-- Filter the text using the module
local FilteredText = Module.Filter(Player, Text)
-- Send the filtered text
game:GetService("ReplicatedStorage").RemoteEvent:FireClient(Player,FilteredText)
end)
Local Script:
game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function(Text)
-- Apply the text
script.Parent.Text = Text
end)
This would be better fit as a tutorial! Instead, teach developers how to use Roblox’s filtering system. That’s all this module does in the 40 lines it has.
I never understood Roblox’s game.TextService:FilterStringAsync, I don’t like this function for the many code writing to just to get a filtered string.
This is why I use ChatService:FilterStringForBroadcast for all cases, it’s simply much easier, better and only requires 1 line rather than having to write 3 or 4 lines.
I find this module actually useful, and I thank you for it. because I never understood that Roblox API.
Do you know why the user ID is required for filtering strings sent from users and between users? Roblox’s P2P filter is based on user age and location* (sometimes). Some users for example cannot say numbers, while most can. Those other filter methods exist for a reason, not just to look pretty.
Hey Alexinite, thanks for the clarification! I appreciate you suggesting me to take another look at the TextFilter documentation.
You’re absolutely right, user ID and age/location filtering are essential for broader chat filtering, especially for experiences going global with players from various countries and languages.
While my focus was on public content like announcements where those filters might not be as crucial, and experiences directed to the English Audience, I understand the broader use cases now.
While my focus was on public content like announcements where those filters might not be as crucial, I understand the broader use cases now. For my specific needs, filtering specific words and phrases using ChatService:FilterStringForBroadcast seems most efficient for public content. However, I completely see the value of the other methods for broader chat scenarios, particularly in global experiences.