Skip to content

Using the filter module

Semaphorism edited this page Aug 27, 2019 · 3 revisions

DISCLAIMER

I take no responsibility for any issues this module causes. The code is public, you have full access to everything this module does and uses for data, therefore it's your responsibility to read over the code if it causes issues. That being said, I am actively going to try to maintain this module by fixing bugs, improving features and keeping the filtering rules updated.

This module is NOT a replacement for the regular Roblox filter, this runs before the official Roblox one, so don't think this is a replacement. In fact, that's against their ToS to remove their filter. This is entirely just to help your game against the scams, and improve your players experience.

Getting started

The filter is unofficial filter to help combat against spam. its fairly simple, and this will guide you how to create rules and custom lists. The idea of it is that spammers will keep changing their spam, so we should keep changing our filters to account for that using community ran filters.

Thing to note is that it automatically lower cases the text

How does it work?

In short, the module makes HTTP requests to the url(s) provided in the module to get a list of filters to run on every message. These lists are formatted in JSON, as it's a large standardized encoding. The default list is public on this repository as well so you can see the phrases it will remove.

Installing the filter module for default Roblox chat

This is easy! All you need to do is create a folder called "ChatModules" (If there isn't one already), under the "Chat" service on studio, create a new ModuleScript instance, and paste the code from the file below

https://github.com/GalacticArc/robloxscripts/blob/master/filter.lua

Example:

Using the module on a custom chat

Custom chat interfaces are also supported, if you use it, it takes a bit of a different step, first create a ModuleScript whereever you want it to be, generally under ServerScriptService would be a good option, paste the code from

https://github.com/GalacticArc/robloxscripts/blob/master/filter.lua

In your server script that runs your user chats, simply run it through the process function on the module

local filterModule = require(game.ServerScriptService.FilterModule)() -- Make sure you call it ()

textTheUserSent = filterModule.process(textTheUserSent)

Creating rules

The only rule flag currently is:

  • all - This flag will replace the entire chat message with hashtags if the text is found within it.

A simple word replacement is as simple as { "text": "oof" }

It will replace any sentence with "oof" with hashtags For example:

"Hello, i love the oof sound!"

Will turn into

"Hello, i love the ### sound!"

With the all flag on, like { "all": true, "text": "oof" } The above phrase will turn into:

"############################"

This allows you to automatically block entire messages if the text is found in the message.

Example file

The example below has 2 rules for a blacklist you can use as a reference

https://github.com/GalacticArc/robloxscripts/blob/master/example-blacklist.json