why does my script get the error of Can't Parse JSON when using the HTTP service?
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