Trying to get a table of accessories from catalog

im trying to get a few accessories from the catalog by using a table but im not sure how to get multiple accessories for LoadAsset. ty!

script:

local is = game:GetService("InsertService")
local assetIDs = {
	86487766,
	16343999100,
	14925906046,
	13397021939
}


local model = is:LoadAsset(assetIDs)

model.Name = "IDs"
model.Parent = game.ReplicatedStorage
1 Like

You will have to iterate through your table since LoadAsset() only works for one ID at a time… It can’t handle tables. I recommend using a for loop and ipairs for this type of situation.

for loop ipairs Documentation

2 Likes

ohh yes i completely forgot. tysm man! is there any way u could like ungroup the model say and put it all the accessories into ONE model instead of like 4:

this is what i got:
image

local is = game:GetService("InsertService")
local assetIDs = {
	86487766,
	16343999100,
	14925906046,
	13397021939
}


for i, number in ipairs(assetIDs) do
	local model = is:LoadAsset(number)
	model.Parent = game.ReplicatedStorage
end

edit: actually i suppose ungrouping it works then adding a model manually.
image

1 Like

Of course!

If you do want to mess with putting everything in one model though:

Unfortunately roblox doesn’t have a function to ungroup models, so you will have to create a model instance with Instance.new and add a nested for loop to go through each loaded asset. From there you would need to set the parent to your created model in ReplicatedStorage.

2 Likes

yes ofc! u saved me so much time tysm man! :smiley:

1 Like

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