Filtering text generated by the server

Hey everyone! I’m currently creating a spelling game and I’m using an external API to fetch a set amount of random (safe) words. However, I’m sure that Roblox would take the game down as some words appear as swear words or something similar, yet they are not. So that made me think that I should definitely implement a text filter in the game.

Sure, easy enough, I start digging through the API documentation, find out about FilterStringAsync… except there’s a problem. It always requires a UserID. A server doesn’t have one, so I came to the idea that I should put my own ID there… except I found this line in the documentation:

This method currently throws if fromUserId is not online on the current server. We plan to support users who are offline or on a different server in the future.

So my question is if that support is now in effect or are we still waiting on it? The whole documentation could be a lot simpler regarding the implementation of the feature in general, but I digress.

If anything, maybe you guys have another idea of how I could pull this off with maybe another built in service or something completely third. :slight_smile:


Update

I have confirmed my theory - you do need a UserID of a player that is in the server. Despite that, the filtering is atrocious. Let me give you a few examples of which words Roblox decided to filter out, which actually surprised me:

polarizer, rustiness, thurible, cloyed, ixtle, schmooze, dyadics

And many more that are simply not filter worthy. I have no idea what Roblox is thinking, but I’m not that surprised. FilterTextAsync works just fine and I will simply have to throw out all the filtered words despite them being not even close to a swear one.

You are best off getting the UserId of someone that is currently in the game and when they leave get another person’s UserId. Though, this might be an inconsistent way of filtering text as people who are under 13 might have different filter results due to age restrictions, though I don’t know if that is considered when using FilterStringAsync as it doesn’t say in the documentation anywhere.

1 Like

I thought of that too, yet what if Roblox uses the IDs as a way of punishing the people? I mean, how else would they know who sends all those slurs and what not people tend to spam in the chat. I might screw someone over by doing that :sweat_smile:

I guess, in a kind of selfish way, that isn’t your problem seeing as I don’t see any other way of doing this, and the fact that doing this in the first place is even possible makes it so anyone could do it.

I’ll either have to test out with my own ID first (To see if Roblox just forgot to take down the alert I showed in the post) or if they haven’t, I’ll get a random player’s ID. Not my fault for designing their service like that, I will blame them for it if they accuse me of screwing someone over on purpose. Though I will most likely lose the argument, knowing who they are to begin with.

If I understand correctly, you are trying to get a list of words that can be shown to any player on the server? If so, then I think you can just use TextFilterResult:GetNonChatStringForBroadcastAsync(v).

Yes, I am trying to display those random words to all players, though I plan on filtering them just before that. However, your suggestion still involves me using FilterStringAsync, so I think it’s inevitable I have to use that one.