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: Whats wrong with this?

Previous Thread :: Next Thread 
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
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
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
10 May 2013 07:57 PM
Bump

http://www.youtube.com/user/TheRD101Person/videos
Report Abuse
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
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
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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 is not online. 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
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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 is not online. 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
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
10 May 2013 10:14 PM
How can you see the Image Button with no frame?
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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
KillerKyle is online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
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 is not online. 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
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
11 May 2013 06:14 PM
Bump
Report Abuse
montanaontario2392 is not online. montanaontario2392
Joined: 24 Mar 2010
Total Posts: 545
11 May 2013 06:16 PM
stop asking us.
Report Abuse
RainbowDash101 is not online. RainbowDash101
Joined: 31 May 2011
Total Posts: 17762
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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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
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