I have a script which imports an accessory using insert service. Insert service imports assets as models, and I would like to change the accessory’s parent, and take it out of the model.
Since I will be importing multiple accessories, I cannot refer to the accessory by name.
I tried the following, but it does not work.
local hat = game:GetService("InsertService"):LoadAsset(31101391)
hat.Parent = game.Workspace
local accessory = hat:FindFirstChildWhichIsA("Accessory")
accessory:Clone().Parent = game.Workspace
Does anyone have any ideas?
You can do accessory:Clone():GetChildren()[1]
as the model only has 1 child which is the accessory.
1 Like
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
local accessory = model:Clone():GetChildren()[1]
accessory.Parent = game.Workspace
I tried this but the accessory did not appear in workspace.
The Handle
part is within the accessory, not the model.
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
this part of the script already imports the model properly, but I want to make it so the accessory is not in the model.