HttpService:RequestAsync()
will yield extremely long even if the external server sends back information. This example uses Parcel’s API to fetch the roblox users’ information, and if you put the link in your brower, it’ll fetch it almost immediately without delay.
Reproduction Code Example
This code does not have to be put in a header, which the main reason why I used this one and not our other ones.
Please keep in mind, this example uses GetAsync()
and RequestAsync
because most of our other endpoints are blocked with hub secret keys, which only can be obtained by our customers.
local HttpService = game:GetService("HttpService")
local function sendRequest()
local res = HttpService:RequestAsync({
Url = "https://api.parcelroblox.com/api/user/check/225887981?option=roblox",
Method = "GET"
})
if res.StatusCode == 200 then
return HttpService:JSONDecode(res.Body)
else
warn("Hub Request Failed:", res.StatusCode, res.StatusMessage)
return false
end
end
local function sendRequest2()
local res = HttpService:GetAsync({
Url = "https://api.parcelroblox.com/api/user/check/225887981?option=roblox"
})
print(res.StatusCode)
if res.StatusCode == 200 then
return HttpService:JSONDecode(res.Body)
else
warn("Hub Request Failed:", res.StatusCode, res.StatusMessage)
return false
end
end
game.Players.PlayerAdded:Connect(function(player)
print("got player added here")
print(sendRequest())
--print(sendRequest2())
end)
Expected behavior
Usually, when the player joins and/or the script starts, this request will go through and now, it’s taking so long which hinders our services even more.