so i have this script it gets about 100 badges from the player and in one post a guy said to use a loop and i also dont know how to change the data to int value.
here is the code:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local badges = Instance.new("IntValue", leaderstats) badges.Name = "Badges" local Http = game:GetService("HttpService"); local fetchBadges = function(userId, badgeLimit) local Badges = Http:GetAsync("https://badges.rprxy.xyz/v1/users/" .. userId .. "/badges?limit=" .. badgeLimit .. "&sortOrder=Asc") print(Badges) toReturn = tonumber(Badges); return toReturn end; fetchBadges(player.userId, 100) badges.Value = toReturn end)
In the Badges API there is a third parameter for specifying the cursor. Basically when you make a request to return the player's 100 badges, it includes a key called nextPageCursor, which is a parameter that you'd include in your link to get the next page. By using a loop he meant keep sending requests with the cursor parameter included until there is no more next page.