|
| 29 Jul 2013 05:16 AM |
I am trying to make a monster for my friend's RPG collab game. And I want the Name of the monster to be somewhat like this: Monster: 100/100 100 being the health and the maxhealth I want them to auto update every .1 seconds so that it would display their health.
I tried the following code but it didn't work. I put it in a model with humanoid and a head
parent = script.Parent health = parent:findFirstChild("Humanoid").Health
while true do wait(.1) parent.Name = "Monster: "..health.."/".."100" end |
|
|
| Report Abuse |
|
|
DrWaffler
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 4248 |
|
|
| 29 Jul 2013 05:32 AM |
Hell no. Don't do loops for this kind of thing.
function updateHealth() health = script.Parent:FindFirstChild("Humanoid").Health maxhealth = script.Parent:FindFirstChild("Humanoid").MaxHealth script.Parent.Name = "Monster: " .. health .. "/" .. maxhealth end
script.Parent:FindFirstChild("Humanoid").changed:connect(updateHealth)
I am reborn as an ocelot. You disapprove. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 29 Jul 2013 05:43 AM |
@DrWaffler:
C'mon bro, use Humanoid.HealthChanged(float health) |
|
|
| Report Abuse |
|
|
DrWaffler
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 4248 |
|
|
| 29 Jul 2013 05:46 AM |
O.O
wat.
how long have we
but that was
who did
wat.
I am reborn as an ocelot. You disapprove. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2013 06:24 AM |
| Probably since Humanoids... |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 29 Jul 2013 06:26 AM |
The Changed event exist for a long time, you know ;)
|
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 29 Jul 2013 09:11 AM |
POOPPOO
HealthChanged = Changed (prop == "Health"
WUT IF U WANNT DETECT MAXHEALTH NAB?! |
|
|
| Report Abuse |
|
|