I'm making a zombie game (generic, I know) that "spawns" a boss zombie when all the other zombies are dead. The boss is floating in the air. All of his parts are transparent, and his torso is anchored. The script should make him visible and un-anchor the torso. Thing is: my script isn't working, and I can't find out why. Please help me. Here's the script:
local z1 = game.Workspace.Zombie1 local z2 = game.Workspace.Zombie2 local z3 = game.Workspace.Zombie3 local z4 = game.Workspace.Zombie4 local z5 = game.Workspace.Zombie5 local z6 = game.Workspace.Zombie6 local z7 = game.Workspace.Zombie7 local boss = game.Workspace["Boss Zombie"] while z1.Zombie.Humanoid.Health == nil and z2.Zombie.Humanoid.Health == nil and z3.Zombie.Humanoid.Health == nil and z4.Zombie.Humanoid.Health == nil and z5.Zombie.Humanoid.Health == nil and z6.Zombie.Humanoid.Health == nil and z7.Zombie.Humanoid.Health == nil do wait() boss.Torso.Anchored = false boss.Torso.Transparency = 0 boss.Head.Transparency = 0 boss.zarm.Transparency = 0 boss.rarm.Transparency = 0 boss["Left Leg"].Transparency = 0 boss["Right Leg"].Transparency = 0 boss.Torso.CanCollide = true boss.Head.CanCollide = true boss.zarm.CanCollide = true boss.rarm.CanCollide = true boss["Left Leg"].CanCollide = true boss["Right Leg"].CanCollide = true end
The died event is an event for Humanoids, and it fires when they die.
What I'm suggesting, is looping through all the zombies, setting up an event, and whenever one dies, decrease a number until it reaches 0. When is does reach 0, fire a function and then add your code. Easy Peas-z.
local num = 7 local boss = game.Workspace["Boss Zombie"] local function SummonBoss() boss.Torso.Anchored = false boss.Torso.Transparency = 0 boss.Head.Transparency = 0 boss.zarm.Transparency = 0 boss.rarm.Transparency = 0 boss["Left Leg"].Transparency = 0 boss["Right Leg"].Transparency = 0 boss.Torso.CanCollide = true boss.Head.CanCollide = true boss.zarm.CanCollide = true boss.rarm.CanCollide = true boss["Left Leg"].CanCollide = true boss["Right Leg"].CanCollide = true end for i = 1,7 do local zombie = workspace:FindFirstChild("Zombie"..i) zombie.Humanoid.Died:connect(function() num = num-1 if num == 0 then SummonBoss() end end end
Good Luck