badfitz99
|
  |
| Joined: 01 May 2010 |
| Total Posts: 5854 |
|
|
| 19 Jun 2014 11:27 AM |
I'm making a zombie wave game, how can I check if all zombies are dead?
-- The scripter of Off-Topic -- ill gnaw ur arm off hagrid! |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 11:28 AM |
| Put them in a model and use pairs to check all there humanoids to see if there dead. Easy as that. :D |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 11:32 AM |
Something like
while wait() do Wkspc = game.Workspace:GetChildren() if Wkspc.Name == "Zombie" and Wkspc.Humanoid.Health == 0 then --stuff end end
|
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Jun 2014 11:33 AM |
for i,v in pairs(workspace:children()) do if v.Name == "Zombie" and v.Humanoid.Health <=0 then --stuff end end |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 19 Jun 2014 11:36 AM |
shin, you're forgetting the loop.
function BodyCount () count = 0 work = Workspace:GetChildren () for i,v in pairs (work) do if v.Name == "Zombie" then if v.Humanoid.Health == 0 then count = count + 1 end end return count end
BodyCount () |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 11:38 AM |
| That explains alot about my code that I'm working on... |
|
|
| Report Abuse |
|
|