klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
|
| 06 Jul 2014 04:13 PM |
wait(5) Humanoid = game.Players.LocalPlayer.Character.Humanoid Humanoid.Health.Changed:connect(function(Val) maxHealth = Humanoid.MaxHealth script.Parent.Health.Text = ("" .. Val .. "/" .. maxHealth "") end)
It isn't working and I can't exactly figure out why or how I can fix it. I'm trying to make it so when a player's health is changed it displays their new health in the form of text on a GUI.
~egmen |
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 06 Jul 2014 04:24 PM |
no spaces after and before .. and no empty string after the last paste.
change to
(""..Val.."/"..maxHealth)
|
|
|
| Report Abuse |
|
|
klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
|
| 06 Jul 2014 04:27 PM |
No, that doesn't seem the be the problem.
'attempt to index field "Health" (a number value)'
~egmen |
|
|
| Report Abuse |
|
|
klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
| |
|
NiceCoder
|
  |
| Joined: 15 Oct 2012 |
| Total Posts: 6593 |
|
|
| 06 Jul 2014 04:53 PM |
| um isn't the humanoid in the game.Workspace.Player ? |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 06 Jul 2014 04:58 PM |
That's not how .Changed works:
Humanoid = game.Players.LocalPlayer.Character.Humanoid Humanoid.Changed:connect(function(prop) if prop=="Health" then maxHealth = Humanoid.MaxHealth script.Parent.Health.Text = (Humanoid[Val] .. "/" .. maxHealth) end end)
And you didn't need the pointless empty quotes near the beginning and ending of the text |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 06 Jul 2014 05:00 PM |
Whoops, fix:
Humanoid = game.Players.LocalPlayer.Character.Humanoid Humanoid.Changed:connect(function(prop) if prop=="Health" then maxHealth = Humanoid.MaxHealth script.Parent.Health.Text = (Humanoid[prop] .. "/" .. maxHealth) end end) |
|
|
| Report Abuse |
|
|