Hey programmers of the forums. I have a big question.
I am trying to destroy my fire and recreate it.
Here is my code:
local fire = script.Parent.Fire
fire:Destroy()
How do I recreate my fire after I destroy it?
Hey programmers of the forums. I have a big question.
I am trying to destroy my fire and recreate it.
Here is my code:
local fire = script.Parent.Fire
fire:Destroy()
How do I recreate my fire after I destroy it?
local fire = --an object
local clone = fire:Clone()
fire:Destroy()
--Some time later
clone.Parent = --Some location
The code above simply clones the object before destroying it, so you can reparent the clone later. Note that if you only have one object, you could also set the parent to nil
instead of destroying it, and then reparent it later.
Instead of destroying, keep a reference to the model and parent it to nil. Reparent it when you want to use it again.
Roblox recomendeds doing this on the wiki
Add this to the end
local remParent = part.Parent
part.Parent = nil
wait(0.1)
debounce = false
wait(10)
part.Parent = remParent
you can just clone it before you destroy then place it again