I took some example code from another topic on how you can get game passes, etc from a player using RoProxy however when I change the AssetTypeId to 5 this error happens.
(5 means a Lua Asset)
Credits to @Forummer for the code.
[Redacted site since it is a phishing URL for some reason]
Error that happens:
Line that errored:
local http = game:GetService("HttpService")
local baseUrl = "https://www.roproxy.com/users/inventory/list-json?assetTypeId=5&cursor=&itemsPerPage=100&pageNumber=%s&userId=%s"
local function getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
gamepasses = gamepasses or {}
pageNumber = pageNumber or 1
lastLength = lastLength or math.huge
local requestUrl = baseUrl:format(pageNumber, userId)
local success, result = pcall(function()
return http:GetAsync(requestUrl)
end)
if success then
if result then
local success2, result2 = pcall(function()
return http:JSONDecode(result)
end)
if success2 then
if result2 then
for _, gamepass in ipairs(result2.Data.Items) do
if gamepass.Creator.Id == userId then
table.insert(gamepasses, gamepass.Item.AssetId)
end
end
if result:len() ~= lastLength then
lastLength = result:len()
pageNumber += 1
getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
end
end
else
warn(result)
getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
end
end
else
warn(result)
getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
end
return gamepasses
end
local userGamepasses = getUserCreatedGamepassesRecursive(2032622)
print(#userGamepasses) --6 gamepasses.
for _, gamepassId in ipairs(userGamepasses) do
print(gamepassId) --6 gamepass IDs.
end
How can I fix the line, so it doesn’t error?