Is there a way I can see if a string's been filtered?

Hi, so for my matchmaking, it’s possible for the player to create a private server, where they can enter in a code and players that type in that code can join their server. I assume the code needs to use Roblox’s string filtration system, so I’m trying to figure out how I can see if the message has been filtered at all after I call the method on it, and if it has been filtered, I can send a response back to the client attempting to create the server with a message like “Your code was moderated, please try a new code.” Or something among those lines.

Any help appreciated, thanks!

If you don’t display the code anywhere, then there is no need for it to be filtered. If you still wish to filter the code, you can check if the string was filtered by checking if it contains a hashtag (#).

2 Likes

It’s better to compare the filtered string and the unfiltered string. If there’s a difference, the string was filtered. Just checking for hashtags will result in all strings legitimately containing hashtags to be falsely deemed as filtered.

6 Likes

That is true. Both methods will work fine as of now, however, your method would work if they stopped using hashtags. I prefer yours.

3 Likes

If unfilteredString ≠ filteredString then
Make player change code
end

Sry I’m on mobile so post is ugly

Edit: oh sry lol Dandystan just said it

1 Like

Do you guys think it’d need to be a requirement to even do this? Basically what happens is players have the ability to create their own servers with unique codes. Only they’ll be able to see what code they’ve selected, but that code would be stored on the server and active for other users to join.

Nonetheless, I did just change my system to filter the given code, but for whatever reason, it literally didn’t filter anything out. I had to put in an explicit message to see if it worked, and it did nothing…

Regardless of the code being visible to other players, any text a player can enter, even only visible to themselves (which I can’t understand why), has to be ran through the filter. The game is at risk of moderation otherwise.

2 Likes

Makes sense. Apparently, the text moderation only comes into play on actual servers, it’s filtering out explicit codes now.

Thanks for the help guys!

Anytime. I actually didn’t know filtering doesn’t work in testing, so thank you for that information!

1 Like

This is circumstantial and not a catch-all case. Text only visible to the client who wrote it does not need to be filtered. However, if you intend to have that text displayed to other users or saved at some point and then displayed in another session, it must be filtered before being sent to the client, even if they were the one who wrote it.

Edit: Handy little chart I drew up regarding this scenario.

3 Likes