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

How to use the Clone() and Destroy() for a zombie spawner?

Asked by
jon924 5
4 years ago

I am currently reworking some of the game designs for my SCP087 map. One of the reworks involves using a ontouch event. when a player touches the invisible platform, SCP087-B (a zombie pretty much) spawns in front of you, chases you for a couple of seconds, and then disappears (which I am guessing is done with Destroy() ).

Some information that may be useful (sorry if it isn't) - The model is a humanoid that already acts like a zombie (Already has a chase script, a kill script, animation script, and more). - The trigger that I'm trying to use is grouped with the model but is not a child of the zombie.

1 answer

Log in to vote
0
Answered by
Sulu710 142
4 years ago

To Clone something write:

local CopiedInstance = Instance:Clone()

To Destroy something write:

Insance:Destroy()

Cloning something will clone that instance and all it's children, and destroying something will destroy the specified instance as well as it's children. So if you Clone() the model of the zombie, all it's children (the scripts, humanoid, etc) will also be cloned. And if you Destroy() the model of the zombie, all it's children will also be wiped.

Ad

Answer this question