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 » Scripters
Home Search
 

Re: Health Bar Sprite that always faces you?

Previous Thread :: Next Thread 
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 04:28 PM
I want to know what object I can use to make a health bar, that would always face your screen, That you wont be able to see after a certain distance.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
16 Aug 2016 04:30 PM
So you're talking about like a BillboardGui?
Make one, clone it into the character's head on respawn, and then adornee it to the Head.

http://wiki.roblox.com/index.php?title=API:Class/BillboardGui


Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 04:31 PM
Yeah Billboard GUI will do, Im just not using it for the player. I can do the rest myself.
Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 04:33 PM
Any idea how to have it invisible from a certain distance away?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
16 Aug 2016 04:38 PM
If you set its size using Offset instead of Scale, it will shrink as distance increases.


Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 04:56 PM
Even if I do use an ExtentsOffset it still gets bigger as I go further away. I have also run into a series of problems. I first need to know how to make a health bar that changes color as health goes, If I shoot the humanoid on the part it doesn't seem to lose health.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
16 Aug 2016 04:57 PM
Other way around.


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 04:58 PM
use scale or put all gui in each players playergui and change the settings manually
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
16 Aug 2016 05:04 PM
Yep sorry, Scale instead of Offset.
To change the color of a health bar as health decreases, I believe it's as simple as this

-- define h as the Humanoid
-- and define frame as the Frame you're sizing and recoloring

h.HealthChanged:connect(function(health)
ratio = health/h.MaxHealth
frame.Size = UDim2.new(ratio,0,1,0)
frame.BackgroundColor = Color3.new(1-(ratio),ratio,0)
end)

-- correct me if I'm wrong, I'm notoriously bad at math.


Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 05:18 PM
ratio is an unknown global, Tried making it a local, didn't work. The color does not change of the frame, And I still cant damage the humanoid. And I'm still not exactly sure what you meant by using scale in stead of offset.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 05:18 PM
a udim2: {scale,offset},{scale,offset}
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
16 Aug 2016 05:20 PM
You need to define Humanoid, and the Frame.
putting the word local in front of the variable ratio should silence that blue underline.


Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 05:21 PM
How this health bar is going to be used is, If you get in a certain radius of the object, (The hitbox part which is what will take damage) it will display an HP bar, with the name of the object, text displaying Hp / MaxHp, and a gradient health bar that will change color as it gets damaged, (Shot in the "Hitbox" part)
Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 05:22 PM
And the blue line went away, but it still does nothing to the frame itself.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
16 Aug 2016 05:22 PM
So you're not using a humanoid?
Change .HealthChanged to just .Changed, then.


Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
16 Aug 2016 05:23 PM
local h = health/maxhealth
bar.BackgroundColor3 = Color3.new((1-h)*1.2,h*1.2,0)
bar.Size = UDim2.new(h,0,1,0)

then the billboard gui setup is really easy if you watch tutorials
Report Abuse
tyler1261 is not online. tyler1261
Joined: 29 Sep 2012
Total Posts: 91
16 Aug 2016 05:26 PM
I am using a humanoid, For some reason, it wont get damaged via gun or sword.
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