PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 16 Jul 2015 06:53 PM |
script.Parent.Text = game.Players.LocalPlayer.Character.Humanoid.Health
Health = game.Players.LocalPlayer.Character.Humanoid.Health
Health.Changed:connect(function(property) script.Parent.Text = game.Players.LocalPlayer.Character.Humanoid.Health end)
:s Im trying to make a health thing (with numbers) |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 16 Jul 2015 06:55 PM |
Health = game.Players.LocalPlayer.Character.Humanoid
Health.Changed:connect(function() script.Parent.Text = game.Players.LocalPlayer.Character.Humanoid.Health end)
|
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 16 Jul 2015 06:56 PM |
local plr = game.Players.LocalPlayer local char = plr.Character local human = char:WaitForChild"Humanoid" local Label = script.Parent
Label.Text = human.Health human.HealthChanged:connect(function() Label.Text = human.Health end)
--make sure this is a local script, <3 |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 16 Jul 2015 06:57 PM |
| Thanks! But.... Now in the bar it says things like 69.900.541.900......... (Yes i know is regenerating function) |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 16 Jul 2015 06:58 PM |
Well if you want to round it do this
-- local plr = game.Players.LocalPlayer local char = plr.Character local human = char:WaitForChild"Humanoid" local Label = script.Parent
Label.Text = human.Health human.HealthChanged:connect(function() Label.Text = math.ceil(human.Health) end) |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 16 Jul 2015 07:00 PM |
| Thanks for the help! :) it works perfectly now |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 16 Jul 2015 07:52 PM |
| BUT it only works in studio, It don't work in-game :/ |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
| |
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 16 Jul 2015 10:19 PM |
make sure you are using a local script
(the script with the little person in a piece of paper on the icon) |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 16 Jul 2015 10:19 PM |
| and that the local script is in startergui, backpack, or replicatedfirst |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 17 Jul 2015 05:35 PM |
Is a gui..
A health bar with numbers in Startergui, That also is in a localscript |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2015 05:39 PM |
local player = game.Players.LocalPlayer repeat wait() until player.Character local char = player.Character local humanoid = char:WaitForChild("Humanoid") local health = humanoid.Health
script.Parent.Text = health
humanoid.Changed:connect(function() script.Parent.Text = health end) Sorry me stupid |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2015 05:40 PM |
.HealthChanged mistake I made
Sorry me stupid |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 17 Jul 2015 05:40 PM |
| bug is: Error, Attempt to index local "char" (a nil value) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2015 05:45 PM |
no, not math.ceil(Health), this just gives the value rounded up, which u'd like is rounded to the NEAREST unit... math.floor(Health + .5)
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 17 Jul 2015 05:47 PM |
| err, I just want it to work in-game |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2015 05:50 PM |
local player = game.Players.LocalPlayer repeat wait() until player.Character local char = player.Character local humanoid = char.Humanoid
script.Parent.Text = tostring(math.floor(health + .5))
humanoid.Changed:connect(function() script.Parent.Text = tostring(math.floor(health + .5)) end)
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
| |
|
|
| 17 Jul 2015 05:59 PM |
what? o.O
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 17 Jul 2015 06:02 PM |
I Jut Wanna The Script To Work In- Game |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2015 06:04 PM |
what's the line of the error?
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
PalomonCP
|
  |
| Joined: 06 Nov 2013 |
| Total Posts: 727 |
|
|
| 17 Jul 2015 06:10 PM |
| AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2015 06:23 PM |
o.O accept the help or just stop bumping this, pick 1 or the other :P
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 17 Jul 2015 10:57 PM |
@kap
You need to round up
you know why?
if health is 1, your health isn't 0, it's better to show as 1 than 0 |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2015 08:39 AM |
ah well, I guess so :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|