Ok that’s fine
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