Basically in some badge counting games it takes .1-.5 seconds to fetch the next page from the badge api’s but my code takes far too long, it works though, I managed to count 14000 badges that I own even though it took almost 15 minutes, 2 seconds to fetch each page…
local dataa2 = Proxy:Get("https://badges.roblox.com/v1/users/51967249/badges?limit=100&sortOrder=Asc")
local ReturnedJSon = game:GetService("HttpService"):JSONDecode(dataa2.body)
local origLenth = 0 -- current badges
--print(ReturnedJSon.nextPageCursor)
local function recurseGetLen(nextpagecursor)
if nextpagecursor then
local newData = Proxy:Get("https://badges.roblox.com/v1/users/51967249/badges?limit=100&cursor="..nextpagecursor.."&sortOrder=Asc")
local ReturnedJSon = game:GetService("HttpService"):JSONDecode(newData.body)
if ReturnedJSon.nextPageCursor then
origLenth = origLenth + #ReturnedJSon['data']
print('continuing recursion: ',origLenth)
recurseGetLen(ReturnedJSon.nextPageCursor)
else
origLenth = origLenth + #ReturnedJSon['data']
print('end recursion: ',origLenth)
end
else
print('new recursion called')
origLenth = origLenth + #ReturnedJSon['data']
print('length: ',origLenth)
recurseGetLen(ReturnedJSon.nextPageCursor)
end
end
recurseGetLen()
Would there be a faster method? Would I need to stop using the proxy server and if so, how would I manage to bypass the trust check? I have seen the badges count way faster than 15 minutes…