How can I generate a random word? I was thinking of doing a 'post request' from http://watchout4snakes.com/wo4snakes/Random/RandomWord but im not sure how to.
✓ ANSWER ACCEPTED
How can I generate a random word?
1 answer
✓ Accepted answer
nvm, This works:
local HttpService = game:GetService("HttpService")
local function randomword()
local response = HttpService:RequestAsync(
{
Url = "http://watchout4snakes.com/wo4snakes/Random/RandomWord", -- This website helps debug HTTP requests
Method = "POST",
Headers = {
["Content-Type"] = "application/json"
},
Body = HttpService:JSONEncode({hello = "world"})
}
)
-- Inspect the response table
if response.Success then
return(response.Body)
else
print("The request failed:", response.StatusCode, response.StatusMessage)
end
end
local success, message = pcall(randomword)
if not success then
print("Http Request failed:", message)
end
print(randomword())
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
i never knew you can use that for random generation cool actually