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: Health GUI Help?

Previous Thread :: Next Thread 
crisxz17 is not online. crisxz17
Joined: 05 Feb 2010
Total Posts: 41
15 Jul 2015 06:13 PM
I tested this script and it works in edit but it wont work in play mode, can someone help?

local player = game.Players.LocalPlayer
local human = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

human.Changed:connect(function(prop)
if prop == "Health" or prop == "MaxHealth" then
script.Parent:TweenSize(UDim2.new(human.Health/human.MaxHealth,0,1,0),"Out","Quad",0.3,true)
end
end)
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
15 Jul 2015 06:17 PM
local char = plr.Character or plr.CharacterAdded:wait()

char.Humanoid.Chaned:connect(function(prop)

"My Life is going Good... but..."
Report Abuse
crisxz17 is not online. crisxz17
Joined: 05 Feb 2010
Total Posts: 41
15 Jul 2015 06:20 PM
Thanks.
Report Abuse
aliandbaheeg is not online. aliandbaheeg
Joined: 10 Jun 2014
Total Posts: 1092
15 Jul 2015 06:22 PM
The issue is you're waiting for the child of a nil value

why is character nil? because the player loads before the character
so do what Kapitanovas said.


-Baheeg
Report Abuse
crisxz17 is not online. crisxz17
Joined: 05 Feb 2010
Total Posts: 41
15 Jul 2015 06:55 PM
I tried it out and it still seems like it isn't working, am I doing something wrong?

local player = game.Players.LocalPlayer
local human = player.Character or player.CharacterAdded:wait()

human.Humanoid.Changed:connect(function(prop)
if prop == "Health" or prop == "MaxHealth" then
script.Parent:TweenSize(UDim2.new(human.Health/human.MaxHealth,0,1,0),"Out","Quad",0.3,true)
end
end)
Report Abuse
crisxz17 is not online. crisxz17
Joined: 05 Feb 2010
Total Posts: 41
15 Jul 2015 07:04 PM
bump
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
15 Jul 2015 07:10 PM
Is it a local script?
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
16 Jul 2015 06:23 AM
^

"My Life is going Good... but..."
Report Abuse
lilblitz56 is not online. lilblitz56
Joined: 06 Nov 2010
Total Posts: 461
16 Jul 2015 06:35 AM
Does that mean yes?

If it is a LocalScript, it needs to be inside the LocalPlayer somehow, so put it in StarterGui or StarterPlayer or something :P
Report Abuse
lilblitz56 is not online. lilblitz56
Joined: 06 Nov 2010
Total Posts: 461
16 Jul 2015 06:36 AM
Oops I wasn't paying attention sorry. I'm assuming it's already in StarterGui since it's inside of a Gui xD Just make sure you're using a LocalScript though.
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