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

How to unlock a parent when destroyed? [SOLVED]

Asked by 5 years ago
Edited 5 years ago

i'm using debris to destroy a part but whenever i do and try to respawn the part back into workspace it gives me this error:

17:42:40.291 - The Parent property of Lightning is locked, current parent: NULL, new parent Workspace

i'm not sure if destroy is a better option in this case or i'll do the same thing, i'm just wondering how i can unlock the parent

script:

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
        if debounce == true then
        debounce = false

        clone.Parent = game.Workspace

        local mousePos = mouse.Hit.p    
        clone.Position = mousePos

        debris:AddItem(game.Workspace.Lightning, 3)

        debounce = true

        end
    end
end)
0
`unlock a parent when destroyed` Kinda the point of destroying an object. TheeDeathCaster 2368 — 5y
0
He wants to create a copy of a part before destroying it and paste wherever his mouse is pointing at on E key press tip mouse movement works at each render frame Robloxian_Hero1234 14 — 5y

1 answer

Log in to vote
0
Answered by
sleazel 1287 Moderation Voter
5 years ago

You cannot destroy an object (via debris or Destroy()) and expect to use it again. You can set the transparency to 1 instead or change parent to the ServerStorage.

delay(3, function()
    game.Workspace.Lightning.Parent = game.ServerStorage
end)
Ad

Answer this question