|
| 21 Dec 2011 02:54 PM |
In the changed event of a humanoid, how would you check if the property is health and if so, what the value of it is.
This is what I've got so far:
script.Parent.Parent.Humanoid.Changed:connect(function(property) if property=="Health" then
end end) |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 21 Dec 2011 02:55 PM |
| Y u no use the HealthChanged event? |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 21 Dec 2011 02:55 PM |
| Your code is correct. The first argument of the function is a string of the property being changed. |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2011 02:58 PM |
| Oh yeah, HealthChanged. If i use healthChanged, how would I know how much health the humanoid has? |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 21 Dec 2011 03:06 PM |
| HealthChanged returns the health as argument. |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2011 03:08 PM |
Or... you could just say...
Humanoid.Changed:connect(function(property) if property == "Health" then local NewHealth = Humanoid.Health -- asdf goes here end end)
Or if you want to be fancy, use HealthChanged. I am old fashion, so I prefer to use .Changed. |
|
|
| Report Abuse |
|
|
Pyzothon
|
  |
| Joined: 26 Oct 2011 |
| Total Posts: 822 |
|
|
| 21 Dec 2011 03:09 PM |
humanoid.HealthChanged:connect(function(newValue) print("The new health is "..newValue) end)
Pyzothon, novice scripter/programmer. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 21 Dec 2011 03:10 PM |
The argument in HealthChanged is the current health
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|