Generating license plates -- and troubles filtering them

I’ve created a system that generates realistic license plates to be displayed on players’ vehicles and that save for each of their vehicles so they have their own unique license plate. However, I’ve run into a few issues.

Nearly EVERY attempt to generate a license plate is filtered, and therefore cannot be used.

I was wondering if I could potentially ignore filtering for the randomly generated numbers, and only filter the letter portion of the license plate; because after my testing, the only reason it was impossible to generate a filter-safe license plate using FilterStringForBroadcast was because of the numbers in it.

And if I can’t do this… what are some ways I could achieve a similar effect without violating the requirement to filter text visible to other users? I’ve seen other games generate DataStore-saved plates but can’t seem to find out how they do so.

2 Likes

I think you’re overcomplicating this; there is one thing that is unique to all players, their UserId. Plus, it looks like a real Plate ID as it is a real ID, and I believe it does not need to be filtered (unless I am wrong; if I am, please correct me). So why not use their UserId?

2 Likes

I find this to be somewhat gray. While the requirement around filtering is that you’re expected to filter any user input-based text, this isn’t that and it’s text generated by you, the developer. On the other hand, it’s randomised text and has the potential to unintentionally generate an inappropriate word, meaning it requires filtering.

There’s definitely no choice as far as ignoring filtering goes in any scenario: if a filter is applied, it must be used in whole without exceptions. The context and word formed isn’t parsed the same way when you change parts of the text either, so the filtering may not be as accurate.

A way you could construct a license plate is to deconstruct the user’s username letter-by-letter and form the plate off of the letters or numbers of their username. It might not give you the effect you’re seeking explicitly (not all letters A-Z would be available) but it’s tacky and you already have the filtering performed from the website.

If you know any developers active on the forum who use such license plate systems, consider CCing (mentioning) them to the thread if they’re willing to explain their plating implementation.

1 Like

Since everyone has a different Username, maybe it can be converted to bytes to resemble a Plate Id using string.byte.

I thought you only needed to filter text when the user chooses the text. Is it necessary to filter them when they are randomly generated?

Well, there’s a few problems with this:

  • Each user can have more than one car, and it’d be nice of their cars had their own unique plate number/letters.
  • Can’t deconstructing their username still lead to unintentional inappropriate words that would still have to be filtered?
1 Like

Those are valid concerns and I don’t have anything to say in response. Didn’t really think about the fact that it’s still in itself random generation and can form an inappropriate phrase.

There isn’t really an easy way around this without either circumventing the intended effect or relying on something completely weird. There’s one more trick I can offer: use of HttpService:GenerateGUID. Use the first section of a returned GUID.

local fullGUID = game:GetService("HttpService"):GenerateGUID(false)
print(fullGUID)
print(string.match(fullGUID, "%w+"))

Results of one test using this code that I got:

37114306-E5A8-4DD5-BEF9-CBD0029DB5CF
37114306

Still random generation but less prone, or not at all prone, to forming inappropriate phrases. Circles back to my comment about there being no real easy way around this.

3 Likes

You don’t need to filter license plates that are randomly generated because it is not user input. So don’t filter it. Problem solved.

You do need to filter license plates that players can write. So, if you have an input field that lets a player set their own license plate text, then you just need to filter that text once they input it.

If you’re worried about the very small chance that a randomly generated license plate contains a bad word, then you can filter that text portion if you really want to, or have your own custom swear filter. But that seems completely unnecessary for me, and I don’t think it’s your responsibility to prevent random swear words from being generated.

1 Like

With recent events showing that custom filters used to remove inappropriate content from a game can get you banned and your game deleted, there’s no way I’m doing that.

In addition to that, the likelihood of a bad word showing up doesn’t matter; the simple possibility of it showing up in the first place is unacceptable. It would HAVE to be filtered. That’s why filtering it needs to happen in the first place; to guarantee that it doesn’t happen. Not because it’s user input.

3 Likes

Random generation does require filtering, regardless of whether it’s user input or not. There is a section on the Text and Chat Filtering article about this, since it’d naturally be a concern.

Some games may find it useful to generate words from random characters that are then displayed to players. There is a chance that such generations could create inappropriate words. In such situations, the displayed result of random words should be sent through a filter on the server. In such cases, the user ID of the player who is going to be viewing the words can be used in FilterStringAsync() .

2 Likes

The wiki is not the roblox TOS.
It seems like that article was written as general guidelines, but not rules.

It’s a rule that text filtering is required for user input. The article helps give further shape to that. When it comes to moderation especially, you don’t want to get on the wrong side or take risks. Maybe you do but I certainly don’t. You are held responsible for any kind of generation of inappropriate phrasing in your games, random or not. I would filter randomly generated text.

Well if this means I don’t have to filter the first three to six numbers of a GUID, then I can keep the realism and just use that. However, if I’d still have to filter those, I’ll have to sacrifice the extreme realism and simply use a user ID based system, potentially even just the user ID being the plate itself and not being unique for each car a player owns.

Definitely learned something here; though it’s clear this challenge is not quite impossible either.

1 Like

Maybe there is a way to just limit which characters can be generated in the text, e.g. excluding vowels and a few consonants common to inappropriate text, and there would be no chance of creating this text by accident.
I feel like this would only cross the line of creating your own custom filter if you tried to search for entire words to filter out, but I’m not sure, I’m definitely no expert.

You could use California’s own list of banned license plate configurations

I suppose this solution both ups the realism and likely covers most cases.

I know you expressed concern about having profanity in your code (I’m assuming you’re referring to this: https://devforum.roblox.com/t/adult-content-in-script-resulting-in-game-deletion/373686 ), but I wouldn’t worry about it. This case was a mistake, which was rectified.

I’m still extremely skeptical of doing my own sort of filtering. I’d like to be as safe as possible unless there’s actually a reputable source for clarification (which I guess would still be playing it safe).

In addition to that, if it was a mistake, why was the reason for the termination explicitly stating that adult content is not permitted in scripts? I don’t see how that could be a mistake. But I suppose we shouldn’t get too off topic.

and uh… I guess the link you sent was deleted or doesn’t exist?

Couldn’t you generate the license plate without any vowels or similar letters(like v and l as they are similar to u and i). You could drop a few other letters as well. You can send it to roblox to filter, but odds are they’ll do a worse job than you, so the tiny risk is still there anyways.

edit: ah crap, someone already mentioned excluding vowels.

1 Like

I guess that’s the closest I could get. I’m still unsure of if I’d have to filter the numbers in a GUID or not, because if I don’t need to do that, that solves my problem entirely since I can just have Roblox filter just the letters and use the GUID for the rest, which fortunately actually works without filtering every single plate number.

You wouldn’t need to filter the numbers, no.
As it is not user input.

Well as previous replies to this thread have shown, it seems to be very up in the air if I should be filtering out GUID as it technically does count as randomly generated. However, it is a number… not a set of letters, so I’m really unsure.

1 Like