|
| 10 May 2013 07:37 PM |
script.Parent.Parent.Parent.Parent.Humanoid.HealthChanged:connect(function(new) if new - 1 then script.Parent.Visible = true wait(.5) script.Parent.Visible = false end end)
I put this localscript in a GUI, and I hoped the gui would be visible for a bit when you take damage.
Its not working.
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 07:41 PM |
1. "if new - 1 then" <--- What is this?
2. There is no "Humanoid" in the Player. It goes, Player.Character.Humanoid. |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 07:51 PM |
@Killer 1. I don't know what else would work. 2. "18:50:25.014 - Players.Player1.PlayerGui.ScreenGui.ImageButton.LocalScript:1: attempt to index field 'Character' (a nil value)"
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 07:57 PM |
Bump
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 08:00 PM |
Give me the whole script, and the Exact location of this script.
You can only use ==, >=, <=, >, or <, to compare Values. That - won;t work there. |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 09:21 PM |
@Killer The script is located in StarterGui.ScreenGui.ImageButton
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 10 May 2013 09:24 PM |
If new is the value of the health
script.Parent.Parent.Parent.Parent.Character.Humanoid.HealthChanged:connect(function(new) if (new < 1) then script.Parent.Visible = true wait(.5) script.Parent.Visible = false end end)
So this would make a death screen or whatever your making pop up |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 09:26 PM |
@john thats not the problem character is still a nil value according to the output
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 10 May 2013 09:38 PM |
Make sure script.parent.parent.parent.parent is actually the Player? because .Character should be a valid way to select the model of the character, the player is representing |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 10:14 PM |
| How can you see the Image Button with no frame? |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 10:28 PM |
@johnhugh i made sure, it's still not working.
@killer IDK, but it worked.
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
|
| 10 May 2013 10:32 PM |
Possible errors.
1. The script is not where you say it is and were all wrong --Solution: Check again
2. Your in Edit mode and Not Build or online mode --Solution: Don't use edit
3. Your script is loading before your Character --Solution, Add a 3 second wait time at the very top of your script. |
|
|
| Report Abuse |
|
|
WishNite
|
  |
| Joined: 11 Feb 2009 |
| Total Posts: 15828 |
|
|
| 10 May 2013 10:34 PM |
@Killer
All Gui Label Instances work in a screengui, a frame is not needed
@OP repeat wait() until game.Players.LocalPlayer.Character ~= nil game.Players.LocalPlayer.Character.HumanoidHealthChanged:connect(function(new) if new < 1 then script.Parent.Visible = true wait(.5) script.Parent.Visible = false end end)
Use game.Players.LocalPlayer in a local script when you want to access the player |
|
|
| Report Abuse |
|
|
|
| 11 May 2013 09:05 AM |
@Wish I want it to pop up every time I take damage is the thing.
http://www.youtube.com/user/TheRD101Person/videos |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 11 May 2013 06:18 PM |
@montana Why do you think this forum is called Scripting HELPERS? What do you expect me to post? |
|
|
| Report Abuse |
|
|
|
| 11 May 2013 06:22 PM |
health = 100 dbun = true game.Players.LocalPlayer.Character.Humanoid.HealthChanged:connect(function(new) if (new < health) and dbun then dbun = false script.Parent.Visible = true wait(.5) script.Parent.Visible = false dbun = true end health = new end) |
|
|
| Report Abuse |
|
|