Wonc
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 60 |
|
|
| 18 Apr 2013 06:37 PM |
I have this script that checks the Zombie's health to see if it's 0 and then sets the Value of BossDead to 1 if it hits zero but it doesn't seem to work at all. Any ideas?
i = 0 health = script.Parent.Health while i = 0 do if health <= 0 then game.Workspace.BossDead.Value = 1 end end
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2013 06:38 PM |
"health" will always be what it was when the script first fired. You also would need two equal signs to check whatever. Also, it would best to use the .Died event.
script.Parent.Died:connect(function() Workspace.BossDead.Value = 1 end )
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2013 06:39 PM |
i = 0 health = script.Parent.Health while i == 0 do--comparing i to 0 wait()--add a wait() if health <= 0 then game.Workspace.BossDead.Value = 1 end end |
|
|
| Report Abuse |
|
|
| |
|
Wonc
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 60 |
|
|
| 18 Apr 2013 06:52 PM |
I still can't seem to get it to work, what would I be replacing with
script.Parent.Died:connect(function() Workspace.BossDead.Value = 1 end )
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2013 06:54 PM |
| Is the script inside of the humanoid? |
|
|
| Report Abuse |
|
|
Wonc
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 60 |
|
| |
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 18 Apr 2013 06:59 PM |
while wait(0.03) do if script.Parent.Health <= 0 then game.Workspace.BossDead.Value = 1 end end
Although, once its health is 0, it will :BreaJoints() so setting its health to one will do nothing |
|
|
| Report Abuse |
|
|
Wonc
|
  |
| Joined: 27 Jul 2010 |
| Total Posts: 60 |
|
|
| 18 Apr 2013 07:02 PM |
| UnBuild, it works perfectly thank you! Thanks everyone, I've been struggling with this one for a while haha. |
|
|
| Report Abuse |
|
|