Unsure on how to use this API?

Ok that’s fine :grinning_face_with_smiling_eyes:

Try this:
local randomFactsURL = “http://api.fungenerators.com/fact/random
local httpService = game:GetService(“HttpService”)
local function FetchFacts()
local response
local data
pcall(function()
response = httpService:GetAsync(randomFactsURL)
data = httpService:JSONDecode(response)
end)

if data.message == "success" then
	if data.contents.fact then
		print(data.contents.fact)
	end
end

end

1 Like

It errored, saying that data.message is nil. I’m going to try tweak it a bit and see

Oh, that means there is no data?

Yes I don’t think anything is being returned

Yep, the message is definitely nil. Also I noticed that it was supposed to be JSONDecode instead of JsonDecode.

Oh ok. I’ll try again then (30 chaaaaars)

Also is HTTP Requests on in your game? If not it won’t work.

It is enabled, I triple-checked that