|
| 11 May 2014 04:43 PM |
Look, I'm trying to create a health bar, and I am searching for calculation for the health. Tryed: fr.Size = UDim2.new(1/(hum.MaxHealth-hum.Health),0,1,0) fr.Size = UDim2.new(1/(math.abs(hum.Health-hum.MaxHealth)),0,1,0) *hum is Humanoid, fr is the health frame ------------------------------------------------------------------- Can anybody give me a formula for that? P.S. Use scaled values. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 11 May 2014 05:04 PM |
| lol not really, but a free Bump for ya ;) |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 05:05 PM |
| For gods sake, just help me. |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 May 2014 05:08 PM |
| everything is important, not jsut only yours |
|
|
| Report Abuse |
|
|
| |
|
| |
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 11 May 2014 05:10 PM |
| well u did do the health - maxhealth correct I can say that... |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 05:11 PM |
Yea, but its 'bugged', code.stypi.com/aleksa12432/testehcals.lua Go to that link to help me. |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 11 May 2014 05:13 PM |
Try this.
Your health is already a percentage, unless you're going over 100.
if humanoid.MaxHealth = 100 then bar.Size = UDim2.new(0,humanoid.Health * scaleFactor,0,othervalue) else bar.Size = UDim2.new(0,(100*(humanoid.Health/humanoid.MaxHealth)*scaleFactor),0,othervalue) end |
|
|
| Report Abuse |
|
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 11 May 2014 05:15 PM |
Then flip the values.
stuff,0,stuff,0 instead of 0,stuff,0,stuff. I gave you some help on the math. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 05:21 PM |
Flipping the values will bug it, example: Create a GUI and a frame Test the frame size to UDim2.new(1,0,1,0), and then test the size to UDim2.new(0,1,0,1) I think that its not the same result. |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
| |
|
|
| 11 May 2014 05:40 PM |
scale covers a percentage of a screen, while offset covers a number of pixels.
not what ur looking for, but oh well :P |
|
|
| Report Abuse |
|
|