i made a script that copys a model to a folder. but it keeps giving me the error The Parent property of Ca is locked, current parent: NULL, new parent Carbin.
script:
game.ReplicatedStorage.CopyCarToSlot.OnServerEvent:Connect(function(player,car1)
local car = game.ReplicatedStorage.Ca:Clone()
car:MakeJoints()
if #car1:GetChildren() == 0 then
car.Parent = car1
end
if #car1:GetChildren() == 1 then
for i,v in pairs(car1:GetChildren()) do
v:Destroy()
wait(.1)
car.Parent = car1
end
end
end)
thx

3 comments
That is because you are destroying Ca and then attempting to reparent it later. If you wish to not use an item now but still need it later, set the parent property of the item to nil and then reparent when it is appropriate to do so. Destroying an item is for when you don't need it anymore.
But Ca is at ReplicatedStorage, and im deleting the children from a folder, which is considered car1.
Just reparent what you're trying to destroy to a storage folder I guess, because I think if you make the parent nil, you're making the folder nonexistent, I'm not sure.