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: How come your health bar is invisible when god?

Previous Thread :: Next Thread 
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:27 PM
I have always wondered why this happened in roblox. Since the early ages of roblox, your health bar turns invisible when you have your health and maxhealth set to infinite (When you are godded)

I have never really took the time to figure it out, but I accidentally discovered why.

I was working on my game (that's outside roblox) and I noticed that when my health and maxhealth was infinite, the health bar disappeared. This is not coded to ever happen. But, I put a percent indicator on my health bar as well. It said "Health nan%"

NaN stands for Not a number. The reason this happens is it first calculates the percent of your health over your maxhealth. With this percent of how much health you have, it basically fills in however much the bar is filled multiplied by your health percent. This makes it invisible.

Apparently, infinity / infinity is that silly NaN according to the Lua interpreter, so it must be similar or the same in the C++ interpreter roblox uses. But since the health bar is a Gui since 2010, it uses Lua to render the health bar, it also returns NaN as well.

But back in 2009, your missing health was red, not just invisible. Why is this?

I think the health rendered rendered the red part of it like this:

-(HealthPercent - 1)

So if you have 80% of your health (0.8), 0.8 - 1 is -0.2, which when we switch signs it is positive 0.2 (20%). With NaN, this will probably also return NaN, resulting in an invisible bar because the rendering code for the health bar fails to render because it is not given the correct data. This means it is completely invisible. But, since this does not exist anymore, the main health bar is also invisible, so either way it is invisible since it is invalid.

healthBarLength * NaN = 0

0 length, so it is not able to be seen



tl;dr: The Lua and C interpreter thinks infinity / infinity is NaN (not a number), which causes the health bar to be invisible. This is true for ALL versions of roblox.
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:29 PM
NaN has been talked about on the blog with the new physics engine recently, and how it causes lag and problems. In my game I am making I am lagging when my health and maxhealth is infinity
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
10 Apr 2013 02:32 PM
The 2009 healthbar was vertical wasn't it? Anyways, I don't believe custom GUIs were available until late 2009 and early 2010. Because of this, the health bar might have been rendered differently since its components were different from the modern healthbar.

PS:

infinity / infinity = 0/0 = anything.

Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:33 PM
Yes, Yellow
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:34 PM
It used to have the red part too, that's why I talked about why I think it is invisible as well.
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
10 Apr 2013 02:36 PM
I'd have to check your logic, because something in me says it just breaks roblox rendering by creating an infinite long Gui item.
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:38 PM
@jobro That's why I assumed until I discovered why it happened to my health bar when it shouldn't
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
10 Apr 2013 02:38 PM
@jobro13,

Experiment time.
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:38 PM
what*
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
10 Apr 2013 02:42 PM
Results:

No crash.

Setting the length too high would cause the studio to automatically resize it to some smaller amount.
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
10 Apr 2013 02:44 PM
'The 2009 healthbar was vertical wasn't it'

Heh, this reminds me when I was sad it was gone and then I later on looked back and wondered why I liked that disgusting object of doom.
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Apr 2013 02:57 PM
@Yellow Of course there's no crash. If it did crash then you would crash if you were godded.

~Kill The Clones is the best game on ROBLOX!~
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
10 Apr 2013 03:00 PM
+1 way to crash Roblox
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Apr 2013 03:59 PM
math.huge is not a number?

Shenanigans. (Probably spelled that wrong, too lazy to copy+paste this into Chrome.)
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
10 Apr 2013 04:01 PM
You spell right, dig.

And math.huge is a hypothetical number, but isn't really.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Apr 2013 04:04 PM
Okay, thanks. Since I keep doing that:

ROBLOX, You gotta add a spellcheck into the in-studio browser!

I know it's not a number. But since it's used so much as a number, that's why I called shenanigans.
Report Abuse
iStone4S is not online. iStone4S
Joined: 07 May 2012
Total Posts: 416
11 Apr 2013 05:37 AM
Back in the days, if someone else is "godded" they would have a red laser as their healthbar which points to the right. c:
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
11 Apr 2013 06:45 AM
@iStone No, normally the red bar would appear, but when you are godded the red part is invisible too
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
11 Apr 2013 06:46 AM
@iStone From what I remember, it was invisible when they made their health math.huge.
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
11 Apr 2013 06:47 AM
@NIN Yes, it was invisible
Report Abuse
iStone4S is not online. iStone4S
Joined: 07 May 2012
Total Posts: 416
11 Apr 2013 06:48 AM
Really? I remember that it was like this in '08, but meh.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
11 Apr 2013 08:01 AM
Bewt math.huge is number. You can make loop that goes on, until it reaches math.huge, and you can see last number that wasn't defined as #inf
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
11 Apr 2013 12:34 PM
NAN means:

Iillegal division by 0

The Health Bar goes invisable at 0.

Ergo, u have 0 health.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
11 Apr 2013 12:43 PM
*sets health to 0*

WEN I DO DAT I DIE D:
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
11 Apr 2013 02:50 PM
@BJ No, NaN stands for not a number, and it is not dividing by zero, its dividing infinity by infinity. If you have 0 health you would die like dig said.

infinity / infinity = NaN
0 / 0 = NaN

NaN * 100 = NaN
NaN + 1 = NaN



NaN behaves like infinity, as performing math on it does nothing to it, except it is like 0 in value, except it is not really 0.

NaN ~= 0
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