Get product info of 10,000 assets

I want to get the product info of 10,000 assets every time a server starts.

What is the fastest/best way to achieve this?
How long would it take?

1 Like
local AssetService = game:GetService("AssetService")
local MarketplaceService = game:GetService("MarketplaceService")

local assetIds = AssetService:GetAssetIdsForUser(userId)

local productInfoList = {}

-- Create a task for each asset ID
for _, assetId in pairs(assetIds) do
  spawn(function()
    local productInfo = MarketplaceService:GetProductInfoAsync(assetId)
    table.insert(productInfoList, productInfo)
  end)
end

-- Wait for all tasks to complete
wait()

-- Do something with the product info list
for _, productInfo in pairs(productInfoList) do
  print(productInfo.Name)
end

1 Like

This would not work since there would be throttling and rate limiting. I’d say that you should find a different method of achieving whatever you’re trying to do here.

2 Likes

I do not recommend doing this everytime the server starts. This could take a while based on the API callback speeds. Also this would definitely throttle, and if a Roblox API for some reason went down or had trouble grabbing the info of a specific asset it will return a nil result. Instead I would do this in Studio, and then store all of the assets you want in a ModuleScript, that way you never need to call those APIs again and worry about throttling / errors retrieving details. Also they would load instantly since they’re cached!

If this is for clothing I would separate them info different modules based on their clothing category. For example Accessories would have their own module, and Shirts would too, etc.

1 Like

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