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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: I need a little Help with this small script...

Previous Thread :: Next Thread 
PalomonCP is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. PalomonCP
Joined: 06 Nov 2013
Total Posts: 727
16 Jul 2015 07:54 PM
Halp??
Report Abuse
CrowClaws is not online. 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 is not online. 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 is not online. 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
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
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
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
17 Jul 2015 05:40 PM
.HealthChanged mistake I made


Sorry me stupid
Report Abuse
PalomonCP is not online. 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
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
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 is not online. 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
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
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 is not online. PalomonCP
Joined: 06 Nov 2013
Total Posts: 727
17 Jul 2015 05:56 PM
unknown global heart
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
17 Jul 2015 05:59 PM
what? o.O

"My Life is going Good... but..."
Report Abuse
PalomonCP is not online. 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
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
17 Jul 2015 06:04 PM
what's the line of the error?

"My Life is going Good... but..."
Report Abuse
PalomonCP is not online. PalomonCP
Joined: 06 Nov 2013
Total Posts: 727
17 Jul 2015 06:10 PM
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
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 is not online. 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
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
18 Jul 2015 08:39 AM
ah well, I guess so :/

"My Life is going Good... but..."
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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