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: Please Help!

Previous Thread :: Next Thread 
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
29 Jun 2016 07:24 PM
This was working fine until I moved it into PlayerGui.

Code:
local Gui = script.Parent --ImageLabel
local Player = game.Players.LocalPlayer
local Character = game.Players.LocalPlayer.Character

Character.Humanoid.HealthChanged:connect(function()
Gui.Position = UDim2.new(((Character.Humanoid.Health / Character.Humanoid.MaxHealth)*.129),0,0.075,0)
end)

ERROR:
20:22:08.905 - Players.Player1.PlayerGui.player_frame.Frame.Health.health_script:5: attempt to index local 'Character' (a nil value)
Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
29 Jun 2016 07:57 PM
Bump
Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
29 Jun 2016 10:12 PM
Bump
Report Abuse
HeIIoISteaIUsernames is not online. HeIIoISteaIUsernames
Joined: 26 Oct 2012
Total Posts: 2906
29 Jun 2016 10:13 PM
local Character = Player.Character


i steal usernames, any user who talks to me is the username i stole
Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
29 Jun 2016 10:14 PM
kk, ill try it
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
29 Jun 2016 10:15 PM
the character does not always load right away, you will need to wait for it

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
zectec is not online. zectec
Joined: 24 Sep 2012
Total Posts: 285
29 Jun 2016 10:16 PM
Umm is this a typo?
"Character.Humanoid.HealthChanged:connect(function()"

You forgot to put a dot where it says HealthChanged

Like this Health.Changed
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
29 Jun 2016 10:17 PM
^ wrong, HealthChanged is an event

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
29 Jun 2016 10:24 PM
Fixed first issue! And now, we have another! The green bar goes down the first time the HP is damaged, then every time it's damaged after the first time the green bar goes up when it's damaged.

LocalScript Code:
local Gui = script.Parent --ImageLabel
local Player = game.Players.LocalPlayer
local Character = Player.Character

wait(5)

Character.Humanoid.HealthChanged:connect(function()
Gui.Position = UDim2.new(((Character.Humanoid.Health / Character.Humanoid.MaxHealth)*.129),0,0.075,0)
end)
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
29 Jun 2016 10:26 PM
I don't know how you do things, but I like to use TweenSize() and just move the bar down by X amount as the player takes damage.

u sicko!
Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
29 Jun 2016 10:51 PM
what's tweensize() do? I looked it up, I barley see anything about it.
Report Abuse
HeIIoISteaIUsernames is not online. HeIIoISteaIUsernames
Joined: 26 Oct 2012
Total Posts: 2906
29 Jun 2016 10:53 PM
basically it's like the scriptable version of the resize tool.


i steal usernames, any user who talks to me is the username i stole
Report Abuse
Sycronox is not online. Sycronox
Joined: 07 Jul 2013
Total Posts: 29
29 Jun 2016 10:58 PM
TweenSize(UDim2.new()) and TweenPosition(UDim2.new()) are basically gui animations. TweenSize changes the gui size with an animation and TweenPosition changes the position with an animation as well.

You can look up this information on the ROBLOX wiki.


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