Changing imported item's parent not working

I’m using import service to import an accessory from the roblox catalog. The only issue is that when an object is imported, it is imported to a model. I want to remove the accessory from the model so I can use the accessory. I cannot :FindFirstChild("Name") because I will be importing different items.

Here is my current importing script:

local model = game:GetService("InsertService"):LoadAsset(31101391)

model.Parent = game.Workspace

model:MoveTo(Vector3.new(-460.829, 95.253, -277.969))
model:WaitForChild("Handle").Anchored = true

The structure of an imported item
image

Things I’ve tried (none of them worked):

local accessory = model:GetChildren()[1]
local accessory = model:FindFirstChild()
local accessory = model:FindFirstChildWhichIsA("Accessory")

(obviously added accessory.Parent = game.Workspace to the end of all these attempts)

Does anyone have any ideas?

1 Like
local model = game:GetService("InsertService"):LoadAsset(31101391)
local accessory = model:FindFirstChildWhichIsA("Accessory")
model.Parent = game.Workspace

model:MoveTo(Vector3.new(-460.829, 95.253, -277.969))
accessory:WaitForChild("Handle").Anchored = true
accessory.Parent = game.Workspace
model:Destroy()

This is the code I have tried, I know you said that you’ve already tried this method, but it seems to work fine for me?

2 Likes

The method LoadAsset that you are using is not void and will return the object. So, whatever you load, it will return that. Therefore, you can try using this snippet of code, and then change the parent to whatever you want.

game:GetService("InsertService"):LoadAsset(assetId).Parent = targetLocation

Hope this helped!