local HTTP = {}
HTTP.URL = "https://raw.githubusercontent.com/PixelLiten/Nethereal/master/0.0.1/files.json"
local http = game:GetService("HttpService")
function HTTP:HTTPGET(url)
local success, res = pcall(http.RequestAsync, http, {
Url = url;
Method = "GET";
})
if (not success) then
res = {
Success = false;
StatusCode = -1;
StatusMessage = res;
Headers = nil;
Body = nil;
}
end
if (not res.Success) then
warn(url .. " >> " .. res.StatusMessage)
end
return res, res.Body
end
function HTTP:HTTPGETJSON(url)
local success, res = pcall(http.RequestAsync, http, {
Url = url;
Method = "GET";
})
if (success) then
local json
success, json = pcall(http.JSONDecode, http, res.Body)
if (success) then
res.Body = json
else
res = json
end
end
if (not success) then
res = {
Success = false;
StatusCode = -1;
StatusMessage = res;
Headers = nil;
Body = nil;
}
end
if (not res.Success) then
warn(url .. " >> " .. res.StatusMessage)
end
return res, res.Body
end
function HTTP:Install()
warn "Fetching file list..."
local filelistRes, filelist = self:HTTPGETJSON(self.URL)
if (not filelistRes.Success) then
warn(filelistRes.StatusMessage)
return
end
end
return HTTP
COMMUNITY QUESTION
why does my script get the error of Can't Parse JSON when using the HTTP service?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Put the full error message, the result of you trying to debug it, which part you think might be the cause, what the script is supposed to do, LITERALLY ANY INFO, don't just make a post and slap a 60 lines of code and hope people will just help you