Ihardyhat
|
  |
| Joined: 06 Nov 2012 |
| Total Posts: 169 |
|
|
| 05 Feb 2014 04:32 PM |
Damage = script.Parent.Parent.Damage.Value
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.Health = h.Health - Damage end end
script.Parent.Touched:connect(onTouched)
if script.Parent.Humanoid.Health<1 then script.Parent:remove() end
This is supost to make the script that causes the zombie to do damage, to get removed when the zombie gets killed, Why wont it work? Please help! |
|
|
| Report Abuse |
|
|
leperdy
|
  |
| Joined: 07 Dec 2008 |
| Total Posts: 1406 |
|
|
| 05 Feb 2014 04:35 PM |
| in a different script use the Died() listening event to trigger this. Or move your if statement within the function. |
|
|
| Report Abuse |
|
|
Ihardyhat
|
  |
| Joined: 06 Nov 2012 |
| Total Posts: 169 |
|
|
| 05 Feb 2014 04:35 PM |
And, If I do this:
Damage = script.Parent.Parent.Damage.Value
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.Health = h.Health - Damage if script.Parent.Humanoid.Health<1 then script.Parent:remove() end
end end
script.Parent.Touched:connect(onTouched)
It will get removed on touch but not when killed, how do I have to do to change that? |
|
|
| Report Abuse |
|
|