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

Zombie Death spawn and de-spawn?

Asked by 9 years ago

I have created a zombie spawn which spawns a model of the zombie every 5 seconds. However the zombies are breaking up into little Pieces with no Health. The first thing I wanted to tackle was getting them to de-spawn here is what I have for them to do so:

1local zombie = script.Parent
2 
3if zombie.Humanoid.Health <1 then
4    zombie:remove()
5end

But they are still not de-spawning.

The second thing is that how do I get the zombie to stay together with full health. here is what I have for the spawning:

01while true do
02 
03function SpawnZombie()
04 
05    local g = game.ServerStorage.Zombie:Clone(1)
06 
07    g.Parent = game.Workspace
08 
09    g.Humanoid:MoveTo(game.Workspace.ZombieSpawner.Position) --Also assuming that the Humanoid is called Humanoid.
10 
11end
12 
13wait(5)
14 
15SpawnZombie(1)
16 
17end

Please help?

2 answers

Log in to vote
0
Answered by 9 years ago
01while true do
02 
03function SpawnZombie()
04 
05    local g = game.ServerStorage.Zombie:Clone(1)
06 
07    g.Parent = game.Workspace
08    g:MakeJoints()--Goes through the Zombie Model and checks if any Part the has a SurfaceType to create joints if it does then it creates the joint.
09    g.Humanoid:MoveTo(game.Workspace.ZombieSpawner.Position) --Also assuming that the Humanoid is called Humanoid.
10 
11end
12 
13wait(5)
14 
15SpawnZombie(1)
16 
17end
Ad
Log in to vote
0
Answered by
Kurieita 125
9 years ago

Most likely the cause of this is there are no joints. Try adding motor6d joints to the head, torso, arms, and legs.

Upvote if this work for you :)

Answer this question