Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The Parent property of Ca is locked, current parent: NULL, new parent Carbin?

Asked by 5 years ago

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

1
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. User#19524 175 — 5y
0
But Ca is at ReplicatedStorage, and im deleting the children from a folder, which is considered car1. ieatandisbaconhair 77 — 5y
0
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. ScrubSadmir 200 — 5y

Answer this question