- What do you want to achieve? Keep it simple and clear!
I want to get a player created assets or get the player inventory
-
What is the issue? Include screenshots / videos if possible!
N/A -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried going on “Scripting Helpers” discord channel and people we’re just giving vague answers without answering much just linking me to
https://api.roblox.com/docs
and
https://api.roblox.com/
and I have no idea what to do with those, I barely have any knowledge with web api’s or how they work and I also found this code at devforum but I don’t want to use it cause I want to create it my own way and actually learn how to do it
so any help would be appreciated, if you didn’t understand what I’m trying to achieve let me know,
I’m basically doing this to get the player created gamepasses shirts and t-shirts to create a game similar to those “Donate me” games
local http = game:GetService("HttpService")
local baseUrl = "https://www.roproxy.com/users/inventory/list-json?assetTypeId=34&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