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:
1 | local zombie = script.Parent |
2 |
3 | if zombie.Humanoid.Health < 1 then |
4 | zombie:remove() |
5 | end |
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:
01 | while true do |
02 |
03 | function 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 |
11 | end |
12 |
13 | wait( 5 ) |
14 |
15 | SpawnZombie( 1 ) |
16 |
17 | end |
Please help?
01 | while true do |
02 |
03 | function 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 |
11 | end |
12 |
13 | wait( 5 ) |
14 |
15 | SpawnZombie( 1 ) |
16 |
17 | end |
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 :)