function onClicked() script.Parent:Destroy() wait(5.5) script.Parent:Clone() end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Why won't this work?
function onClicked() script.Parent:Destroy() wait(5.5) script.Parent:Clone() end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Why won't this work?
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.
1 comment
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