generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help with this?

Previous Thread :: Next Thread 
klkljr is not online. 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 is not online. 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 is not online. 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 is not online. klkljr
Joined: 14 Mar 2011
Total Posts: 9823
06 Jul 2014 04:43 PM
bump

~egmen
Report Abuse
NiceCoder is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image