Dealing with word generations

I’m using a public api to generate random words (for dummies and server names) however it generates texts like this and I fear it’ll get us in trouble. Any way around it or any other public lists I can use safely?
image
image

2 Likes

Simply add blacklists of words you would not like to be used, then use an if statement stating if the text includes the blacklisted words, then reroll the words.

You could use a random wordlist from somewhere like GitHub and use a ModuleScript to return a random word from that list, using HTTP requests seems awful in general for a purpose like that.

In addition you can modify the wordlist to suit your liking.

That’d be a long list though.

That’s what I’m exactly doing.

local _success, _info = pcall(function()
		local _randomWords = HttpService:JSONDecode(HttpService:GetAsync("https://random-word-api.herokuapp.com/word?number="..math.random(10,20)))
		_sharedWords.Words = _randomWords
		game:GetService("SharedTableRegistry"):SetSharedTable("_Words", _sharedWords)
		workspace:SetAttribute("_serverName", ServerData.country_name.." / "..firstToUpper(_randomWords[math.random(1, #_randomWords)]).."-"..firstToUpper(_randomWords[math.random(1, #_randomWords)]))
	end)

Also I can’t simply filter as it’ll result in a server name like Undecisive-###### which would be confusing, unless there’s some sort of loop I can use.

That’s what ModuleScripts are for!
They exist also to seperate long code into requires and methods.

Edit: In addition, using HTTP is a bad idea regardless. if the server you’re requesting from ever becomes slow, your script will hang until the server responds.

I know, It’s no different from using the built in text filter methods. As I stated here.

Ask chatgpt to generate a module of words that do not contain sexual or other words along the lines of the danger zone. This could be better as you wont have to do any filtering.

Ew…

One Google search later

Or use that, I only suggested chatgpt as its quick and easy.

The problem with ChatGPT generating a wordlist is the fact that AIs don’t really like generating long arrays of anything, wordlists need to be big to prevent duplicates by picking at random chance.

1 Like

After importing the words see if the word gets filtered, if it does then just choose another word.

The github repository you provided does not support JSON. You need to find another one.

Orr… OP Could use this:

To filter out bad words.

It’s pretty easy to convert a JavaScript array to a Lua table.

Just swap

const words = [

to

local words = {

And remember to do the ending.


Having references to bad words in your code seems like a very risky move, Especially in Roblox.

True but it would take up a lot of memory and isn’t efficient. The github repository also doesn’t contain ALL words. It merely has 2903 words! I am pretty sure there are more than that amount of words.

No, it’s not? How? Please explain. Roblox scripts can actually have any time of bad word as long as it’s not display to the user themselves. So that statement of yours is wrong.

Got a 1 Day ban after having some words inside comments…

Seems you probably showed something else. I can assure you, having them is fine. And also, we are fetching a data outside of roblox so not really anything bad. I remember doing this previously and didn’t got banned.

image

DId some counting and the entire array is just ~37.56kb.

Oh. That’s cool. Though, we could still use some other website to minimize this even more.

This doesn’t have the word bisexuals in it.

Maybe it’s because it’s not bad? You could still use my idea of filtering the string, and then getting another string.