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 |
|
|
|
| 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
|
  |
| Joined: 05 Feb 2010 |
| Total Posts: 41 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| Joined: 05 Feb 2010 |
| Total Posts: 41 |
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|
|
| 16 Jul 2015 06:23 AM |
^
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|