Using HTTPService to get a random word from google

So I just want a script that uses HTTPService (idk on using HTTPService) to get a random word from google and then just place it in a table something like this

Code → gets random word like (contant)
Code → returns our word
Code → places it in tabl

you need some website like a random word generator
then you can get it’s requests
https://randomwordgenerator.com/ can help

Nvm, this is better Random word API

local url = "https://random-word-api.herokuapp.com/word?number=10"

print(game.HttpsService:JsonDecode(game.HttpsService:GetAsync(url)))

Untested

You can GetAsync a website that can return a random word generator for you. I found this website where it does that.

https://random-word-api.herokuapp.com/home

print(game.HttpService:GetAsync("https://random-word-api.herokuapp.com/word?number=1"))
-- returns table (json) with a random word, you can change the amount by changing the "number=1"

So you need to loop through the table.

You first need to decode it though using HttpService:JSONDecode(). Looks like you already posted the solution before me lol.

Hmm I will see what it does then Ill mark yours as the solution!

Side-Note: Can you please explain HttpService to me?

so umm it gives some really complex words isnt there a way to get less complex words?

well, you could use a different word generator?

Also , why do you want less complex words?

I also don’t understand it very much. I know the basics like discord webhooks and website post and get.

so that people wont get confused like look!
image
those are some hard core words
after then i only know about are 2

woah that’s too complex

okay I’ll try to find another word generator unless I find a way to get less complex words

also i didnt found any :confused:

:o thank you :smiley: that really helps to be honest!

Ok wait, do you see this url thingy? Make it
local url = “https://random-word-api.herokuapp.com/word?number=10&swear=1

I think it will block most complex and no swear words

well in the api it did said that swear=1 = swear words and swear=0 = no swear words but lets give it a shot!

well that just makes it worse :confused:

roblox censored words

welp now what i have in mind is to make it get all the words and select a few words from it and also the lesser the chars the lesser the complexity (in my case)

https://random-word-api.herokuapp.com/all

Welp @geometricalC2123 looks like I have found the code…

local HttpService = game:GetService("HttpService")

local NumOfWords = 3
local Complexity = 5

local function GenerateWord(len)
	local url = "https://random-word-api.herokuapp.com/all"
	local response = HttpService:GetAsync(url)
	local decoded = HttpService:JSONDecode(response)
	local totalwords = {}
	local gottenwords = 0
	repeat
		local w = decoded[math.random(1,#decoded)]
		if string.len(w) <= Complexity then
			gottenwords += 1
			table.insert(totalwords,w)
		end
		wait()
	until gottenwords == len
	return totalwords
end

local Words = {}

Words.WordTable = GenerateWord(NumOfWords)

return Words

its slow but works I mean the words are hard but still easy

1 Like
local HttpService = game:GetService("HttpService")

local NumOfWords = 3
local Complexity = 3

local function GenerateWord(len)
	local url = "https://random-word-api.herokuapp.com/all"
	local response = HttpService:GetAsync(url)
	local decoded = HttpService:JSONDecode(response)
	local totalwords = {}
	local gottenwords = 0
	for i,v in pairs(decoded) do
		local w = decoded[math.random(1,#decoded)]
		if string.len(w) <= Complexity then
			gottenwords += 1
			table.insert(totalwords,w)
		end
		if gottenwords == len then
			break
		end
	end
	return totalwords
end

local Words = {}

Words.WordTable = GenerateWord(NumOfWords)

return Words

faster but laggier

Ok, you should also filter it with Roblox.