I’m trying to get a player’s rap but my script loops with errors when a player has his inventory hidden.
My code :
local baseUrl = "https://inventory.roproxy.com/v1/users/"..Plr.."/assets/collectibles?sortOrder=Asc&limit=100"
local function getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor)
recentAveragePriceCumulative = recentAveragePriceCumulative or 0
print(cursor)
cursor = cursor or ""
local requestUrl = baseUrl:format(userId, cursor)
local success, result = pcall(function()
return HttpService:GetAsync(requestUrl)
end)
if success then
if result then
local success2, result2 = pcall(function()
return HttpService:JSONDecode(result)
end)
if success2 then
if result2 then
for _, collectible in ipairs(result2.data) do
if collectible.recentAveragePrice then
recentAveragePriceCumulative += collectible.recentAveragePrice
end
end
cursor = result2.nextPageCursor
if cursor then
return getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor)
else
return recentAveragePriceCumulative
end
end
else
warn(result2)
getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor)
end
end
else
warn(result)
print(userId)
getTotalRecentAveragePriceRecursive(Plr, recentAveragePriceCumulative, cursor)
end
end
local totalRecentAveragePrice = getTotalRecentAveragePriceRecursive(Plr)
return FastInfo:NumberEasy(totalRecentAveragePrice)
Output :
How am I supposed to check if the player inventory is hidden ?