|
| 26 Mar 2016 02:32 PM |
I was wonder how I can "slice" health values.
I have two separate bars, one for "armor" and one for normal health
I am trying to get the added MaxHealth from Health.
Example:
Say I have 145 Health (45 is the added MaxHealth)
I was wondering that once I reach 100 Health (filling the red bar)
the 45 would continue on the blue bar (armor) |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Mar 2016 03:00 PM |
Ugh, I bet there's some math involved in this...
bump |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 26 Mar 2016 03:05 PM |
| What you're saying is pretty vague, explain? |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:10 PM |
what the heck this is grade kindergarten math
maxHealth - 100 |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:18 PM |
Nooo, I'm trying to slice it, meaning make the added MaxHealth display on a separate bar.
The health bar will display the normal default (100), but anything added to default will continue to display on another bar. |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:20 PM |
prntscr.com/akeke5
This is my GUI setup.
The blue bar is the display of added MaxHealth, so the example (45)
and red bar is the normal health (100).
I want the 45 to display on a separate bar, basically continuing. |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Mar 2016 03:22 PM |
size, displayed as a bar.
but i'm afraid this is some math related stuff. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 26 Mar 2016 03:24 PM |
| 145-100 = 45 thats pretty easy math. you just tween the bar size for however much maxhealth you want. |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:25 PM |
@Time
So I just tween the blue bar according to 45? |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:26 PM |
that's ez pz
added health = maxhealth - 100 red bar size = (size/100)*(maxhealth-added health) blue bar size = (size/added health)*(maxhealth - 100) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 26 Mar 2016 03:28 PM |
| no wait blue bar size = (size/added health)*(heatlh - 100) |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:33 PM |
this is my code:
local Player = game.Players.LocalPlayer repeat wait() until Player.Character local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid")
function ChangeSize(Front, Algorithm) -- easier i guessss Front:TweenSize(UDim2.new(Algorithm, 0, 0.15, 0), "Out", "Quad", 0.5, true) end
Humanoid.HealthChanged:connect(function(Health) local MaxHealth = Humanoid.MaxHealth local Algorithm = (Health / (MaxHealth)) ChangeSize(script.Parent.StatusBarFrame.Health, Algorithm) end)
im not sure what to do, since this is how i executed it.
sorry, im just confused at this math stuff. :( |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:35 PM |
| did you look at my math yet |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:36 PM |
@legitimatly
Yes, I did look at it, however, I'm confused at how I can place it in. Since I was trying this with two scripts earlier until now. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 26 Mar 2016 03:39 PM |
Now I'm just trying stuff:
Algorithm = (Health - 100/ (MaxHealth)) Algorithm = (Health / (MaxHealth - 100)) |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 03:47 PM |
I cannot figure this out, I do not understand this.
bump |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Mar 2016 04:21 PM |
| never mind, ill just go another method, it was worth trying though |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 04:26 PM |
been answered 3+ times! Armor=maxhealth-100 |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 04:35 PM |
@bad
nevermind, i just didn't get how to make it be compatiable, but im good now i have another method |
|
|
| Report Abuse |
|
|