How To Use Bundle Ids In Code

Hello. I am trying to retrieve all of a bundle’s assets from its bundle id, but I am unsure how to do this.

Firstly, I need to determine whether the id is an asset (Enum.AssetType) or a bundle (Enum.BundleType). I have tried using MarketplaceService:GetProductInfo(), but it does not work with bundle ids. Additionally, I am aware of Enum.AvatarItemType; however, I do not know how to get this enum from the id. If someone knows how to obtain the Enum.AvatarItemType, that is the first and most important step in this.

Secondly, I need to obtain the ids of all assets included in the bundle. I am aware that I could use a proxy to get that information from https://catalog.roblox.com/v1/bundles/id/details, but I would really rather not rely on the use of proxies. Is there a Roblox-native option that I could use? Any help is greatly appreciated! Thanks!

Try using AssetService:GetBundleDetailsAsync(). Note that it’s actually Async, not sync. Not sure why but the function name on the docs seems to be messed up.

Thanks so much! That solves the second half of my dilemma. Do you know how I can get the Enum.AvatarItemType from the id or another approach to differentiate asset from bundle?

Yeah, GetBundleDetailsAsync contains a table of relevant ids and the “Type” index in each of the entries will tell you which AvatarItemType it is. If it’s an asset, the Type will be Asset, if it’s a bundle it would be “UserOutfit”


image

:GetBundleDetailsAsync() is for bundle ids, however. I need to know whether it’s a bundle or an asset before using it. Enum.AvatarItemType is the best thing I found for that so far. Do you know how that determination can be accomplished?

Ohh I see, my bad. I’m not too sure about that, what information do you have before making the request? If it’s just some arbitrary number, I don’t think there’s a way to differentiate them other than just comparing the number with some reasonably low number that’s too high to be a bundle but too low to be an accessory (eg. 100,000; the first accessories’ IDs are a bit higher than 1 million). If it’s smaller than this number, it’s a bundle, but if higher then it’s an asset. Then you should be able to pass that ID to MarketplaceService:GetProductInfo (which I’m just now realizing also works and provides the IDs of each of the body parts’ assets).

That enum you provided doesn’t seem to have any references so it’s hard to tell exactly what that’s used for. But in that case I would assume that a body part and an accessory would both be considered an Asset under the AvatarItemType. Not too sure though, sorry.

1 Like