How to tell if a player's text got filtered?

Looking at making a system for a game where player’s can customize the name of their base.

I do know how to do text filtering, as seen in this article: Text Filtering | Documentation - Roblox Creator Hub

However, I want to make a system where if the text the player inputs gets filtered at all, it gives a warning to the player, and tells them to try again, instead of letting their input go through with a bunch of hashtags.

How would I do this?

2 Likes

This fourm should help you

3 Likes

Makes sense, but it didn’t tell me how to detect when a player’s input got filtered. E.G. think of cases where the player puts something inappropriate there, where hashtags would show, and cases where a player intentionally puts hashtags there for something like “#TaylorGang

1 Like

You could find the end of whatever word the hashtag is preceding. Here’s what I mean for example:

local input = …
local function wasFiltered(input: string)
   local start = input.find("#")
   local filtered = false
   local endd = nil
   for i = 1, input.Length do
      if input.sub(i, i) == "#" then continue end
      end = i
      break
   end
   return (start ~= nil) and (endd ~= nil)
end

print(wasFiltered(input))

If Roblox filters something then I’d assume they’d filter a whole string

2 Likes

From my experience, ROBLOX is very inconsistent with filtering. Sometimes it will filter parts of the sentence, sometimes it will filter the whole damn thing.

2 Likes

Thats cause sometimes they hard-code filtering :sob::pray: but I’m not sure theres a way to detect filtering besides having to replicate the whole filtering system and detect if it triggers, or just fire a remote event from the module itself when it filters something

then again, this is just my guess, and I honestly have no idea how the filtering modules work

1 Like

I also might just make a system where if there’s more than 2 or 3 hashtags detected in a string post-filtering, it just rejects the input completely.

1 Like