How to retrieve a player's inventory (What limited items they own)

Hello there, i need help,
i made a player inventory that shows all your limiteds you own. I cannot send requests to ROBLOX API so i used proxies, but i get the error: “Name” is not a valid member of assetType.

Can someone fix it, thanks!

Here is the script.

local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local playeri = Players:GetUserIdFromNameAsync("Florentin5434")
local player = Players:GetPlayerByUserId(playeri)

local url = string.format("https://inventory.roproxy.com/v1/users/%d/assets/collectibles?sortOrder=Desc&limit=100", player.UserId)
local response = HttpService:RequestAsync({
	Url = url,
	Method = "GET",
	Headers = {
		["Content-Type"] = "application/json",
		["Accept"] = "application/json"
	}
})

if response.Success then
	local responseBody = HttpService:JSONDecode(response.Body)
	for _, asset in ipairs(responseBody.data) do
		if asset.assetType.Name == "Limited" then
			print(asset.Name)
		end
	end
else
	warn("Error retrieving inventory data:", response.StatusMessage)
end
1 Like

This is an example response:

{
  "previousPageCursor": "string",
  "nextPageCursor": "string",
  "data": [
    {
      "userAssetId": 0,
      "serialNumber": 0,
      "assetId": 0,
      "name": "string",
      "recentAveragePrice": 0,
      "originalPrice": 0,
      "assetStock": 0,
      "buildersClubMembershipType": 0,
      "isOnHold": true
    }
  ]
}

There is no assetType field in each asset object.

Thanks, could you write an example script if you would like?

You should not have to check if the item is a limited as the endpoint should only return limiteds.

I know, i just want to ask if you could make it that they print out the limited items names as a script??

may be wrong but if u just removed

would it not print the names then since that endpoint would only get limiteds anyway? correct me if im mistaken since i probably am

As i said, it prints out: “Name” is not a valid member of assetType.

i get the error: “Name” is not a valid member of assetType.

That is impossible, tables that don’t have metamethods will never error from indexing a key that doesn’t exist.

I am sorry for the confusion, the error is “attempt to index nil with “Name”.”

the issue is with the line I mentioned I believe as it is trying to find the Name of assetType which doesnt exist

https://inventory.roproxy.com/v1/users/%d/assets/collectibles?sortOrder=Desc&limit=100

It gives me code 400??

local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local playeri = Players:GetUserIdFromNameAsync("Florentin5434")
local player = Players:GetPlayerByUserId(playeri)

local url = string.format("https://inventory.roproxy.com/v1/users/%d/assets/collectibles?sortOrder=Desc&limit=100", player.UserId)
local response = HttpService:RequestAsync({
	Url = url,
	Method = "GET",
	Headers = {
		["Content-Type"] = "application/json",
		["Accept"] = "application/json"
	}
})

if response.Success then
	local responseBody = HttpService:JSONDecode(response.Body)
	for _, asset in responseBody.data do
		print(asset.name)
	end
else
	warn("Error retrieving inventory data:", response.StatusMessage)
end

You have already filtered it so that only collectibles are shown in the URL.


Therefore, you don’t need to check in your script.

Thank you, it worked for me now.

But one last question, how can i make an image for the specified limited item?

Use InsertService:LoadAsset to get the item, then put it in a viewport frame

@COUNTYL1MITS’s method is better

You could use the rbxthumb protocol to easily get thumbnails.

With what type?

You should use the Rolimon’s API to get significant details on the player, as well as their limiteds. From the look of it, it’s most likely easy to use.

The Asset type should work for limiteds.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.