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
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"
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)
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
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