#I'm Creating a Wave System, and I want to check if all clones are Dead before Starting the Next Wave
5 messages · Page 1 of 1 (latest)
You can track the quantity of enemies spawned using an IntValue, adding 1 to the count for each enemy you clone. Assuming you are using Roblox's standard Humanoid in your zombie, you will know it is dead when the Humanoid.Health property reaches 0. When this happens you can subtract 1 from the IntValue used to track the currently alive Zombies.
Here is a rough idea of what that would look like
-- In your zombie spawning script
ZombieCounter = Instance.new('IntValue')
ZombieCounter.Name = 'Zombies'
ZombieCounter.Parent = game.Workspace
function SpawnZombie()
ZombieCounter.Value += 1
end
-- In your Zombie's model with a Humanoid
Zombie = script.Parent
ZombieCounter = game.Workspace:FindFirstChild('Zombies')
Humanoid = Zombie:WaitForChild('Humanoid')
Humanoid.Died:Connect(function()
ZombieCounter.Value -= 1
end)
k thx fam it worked
** You are now Level 1! **
a better way to do this actually was in the spawner script, make a folder for the zombies to go to. have the zombie copy parent = workspace.Folder
zombieCopy.Parent = workspace.Enemies