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: Transfering MaxHealth (slicing Health)

Previous Thread :: Next Thread 
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 02:41 PM
bump
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 03:00 PM
Ugh, I bet there's some math involved in this...

bump
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
26 Mar 2016 03:05 PM
What you're saying is pretty vague, explain?
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
26 Mar 2016 03:10 PM
what the heck this is grade kindergarten math

maxHealth - 100
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
26 Mar 2016 03:21 PM
in text or size
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 03:22 PM
size, displayed as a bar.

but i'm afraid this is some math related stuff.
Report Abuse
TimeTicks is not online. 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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 03:25 PM
@Time

So I just tween the blue bar according to 45?
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
26 Mar 2016 03:26 PM
yes
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
26 Mar 2016 03:28 PM
no wait blue bar size = (size/added health)*(heatlh - 100)
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
26 Mar 2016 03:35 PM
did you look at my math yet
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
26 Mar 2016 03:36 PM
._.
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 03:37 PM
._.
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 03:39 PM
Now I'm just trying stuff:

Algorithm = (Health - 100/ (MaxHealth))
Algorithm = (Health / (MaxHealth - 100))
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 03:47 PM
I cannot figure this out, I do not understand this.

bump
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 04:05 PM
bump
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 04:21 PM
never mind, ill just go another method, it was worth trying though
Report Abuse
badguy1233 is not online. badguy1233
Joined: 23 Jul 2009
Total Posts: 885
26 Mar 2016 04:26 PM
been answered 3+ times!
Armor=maxhealth-100
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
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