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
01 | local httpservice = game:GetService( "HttpService" ) |
02 |
03 | game.Players.PlayerAdded:Connect( function (p) |
04 | local url = "https://badges.rprxy.xyz/v1/users/" ..p.UserId.. "/badges?limit=100&sortOrder=Asc" |
05 | while true do |
06 |
07 | local request = httpservice:JSONDecode(httpservice:GetAsync(url)) |
08 | local cursor = request.nextPageCursor |
09 | if cursor = = "null" then |
10 | break |
11 | else |
12 | url = "https://badges.rprxy.xyz/v1/users/" ..p.UserId.. "/badges?limit=100&sortOrder=Asc&cursor=" ..cursor |
13 | p.leaderstats.Badges.Value + = 100 |
14 | end |
15 |
16 | end |
17 | end ) |
That's what happened to me quite a bit, as you see you are using += 100 and when it reaches the last page it won't add the value, it will add 100...
Basically you just need to add the total inside the page...
iirc, p.leaderstats.Badges.Value += #request.body or #request?
Note: Badges api no longer works for anyone who comes across this 5/18/21