Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a part come back after being destroyed?

function onClicked() script.Parent:Destroy() wait(5.5) script.Parent:Clone() end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Why won't this work?

1 comment

0

if you destroy the parents script you also destroy every child of that object, including the script, so you have to figure out a way to "destroy" it without actually destroying it, maybe turn it invisible and set canCollide false

1 answer

Hello! You can do this by:


function onClicked() 
local temp = script.Parent:Clone()
script.Parent:Destroy() 
wait(5.5) 
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

I cloned the object BEFORE destroying it, so you can use temp as your new object.

This discussion is preserved as it was. New answers, comments, and votes are closed.