Hello, I'm trying to make a badge counter like the one in this (http://www.roblox.com/games/5166670285) game.
But when I use it, it gets something like 32,500 instead of 32,452. If anybody could help it would be very much appreciated
heres my code
local httpservice = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(p)
local url = "https://badges.rprxy.xyz/v1/users/"..p.UserId.."/badges?limit=100&sortOrder=Asc"
while true do
local request = httpservice:JSONDecode(httpservice:GetAsync(url))
local cursor = request.nextPageCursor
if cursor == "null" then
break
else
url = "https://badges.rprxy.xyz/v1/users/"..p.UserId.."/badges?limit=100&sortOrder=Asc&cursor="..cursor
p.leaderstats.Badges.Value += 100
end
end
end)

4 comments
What method are you using to count the badges. The API doesn’t appear to return a number of badges.
the api returns a list of badges and a next page cursor. the next page cursor makes a 2nd list of 100 badge that the user has been awarded. So i am just counting 100 per a request
But the user probably doesnt have a badge count in the multiples of 100. So i am trying to get how many badges there is on the final list
Put all the values inside “data” into a table and use table.len or # to count the number of entries.