Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Zombie Death spawn and de-spawn?

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:

local zombie = script.Parent

if zombie.Humanoid.Health <1 then
	zombie:remove()
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:


while true do

function SpawnZombie()

    local g = game.ServerStorage.Zombie:Clone(1)

    g.Parent = game.Workspace

    g.Humanoid:MoveTo(game.Workspace.ZombieSpawner.Position) --Also assuming that the Humanoid is called Humanoid.

end

wait(5)

SpawnZombie(1)

end

Please help?

2 answers

✓ Accepted answer
while true do

function SpawnZombie()

    local g = game.ServerStorage.Zombie:Clone(1)
	
    g.Parent = game.Workspace
	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.
	g.Humanoid:MoveTo(game.Workspace.ZombieSpawner.Position) --Also assuming that the Humanoid is called Humanoid.
	
end

wait(5)

SpawnZombie(1)

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 :)

This discussion is preserved as it was. New answers, comments, and votes are closed.