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 » Scripting Helpers
Home Search
 

Re: I Added ONE Line of Code and my Script Broke

Previous Thread :: Next Thread 
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
11 Feb 2013 05:48 PM
PLEASE DO NOT SKIM, OR YOU MAY NOT KNOW HOW TO HELP ME

Okay, I would just give you the whole Script but it's really long, and I can't just give you the one line that broke it, so I'll give you a few surrounding lines.

This is for a custom health bar:

function onHealthChanged()
if Humanoid.Health ~= 0 then
local NS = Humanoid.Health * 2.5
S = UDim2.new(0,tonumber(NS),0,27)
end
end

Humanoid.HealthChanged:connect(onHealthChanged)

The line that broke the Script, was line four:

S = UDim2.new(0,tonumber(NS),0,27)

Just so you know. on line 2, I have variables leading up to the Humanoid, so that's not the problem. Also, S, is the Size Property of an ImageButton.

ALSO, no Output.

Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
11 Feb 2013 05:54 PM
What should happen but doesnt?
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
11 Feb 2013 05:56 PM
Well, this is for a health bar, the health bar should resize by shrinking slightly to the middle, but sadly it doesn't, and *Sigh* no Output.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
11 Feb 2013 05:56 PM
just saying you don't need "tonumber()" there...
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
11 Feb 2013 05:56 PM
Well, you should use (health/maxhealth, 0, sizescale, sizeoffset)
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
12 Feb 2013 07:06 AM
I don't know how that would help, since I only need to re-size the second argument. Remember, the health bar is TWO AND A HALF times longer in pixels (250) then your health (100)!

Anyone else have any ideas?
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
12 Feb 2013 07:31 AM
NO-ONE has any?
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
12 Feb 2013 08:19 AM
You could always do it by the:

AmountOfHealth/TotalHealth x 100


Gets the percentage.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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