i made this script when player dies makes gui appear but it doesn't. At first it worked but when i changed my gui location it doesn't work and it broke.. -.- i tried onDie functions did not work either...
this is how my setup looks: http://prntscr.com/8b2mqw
01 | Player = script.Parent.Parent.Parent.Parent.Parent.Character |
02 | s = Player.Humanoid |
03 |
04 | while true do |
05 |
06 | if s.Health < = 0 then |
07 | script.Parent.Wasted 01. Visible = true |
08 | script.Parent.Wasted 02. Visible = true |
09 | wait( 2.50 ) |
10 | script.Parent.Visible = true |
11 |
12 | end |
13 | wait() |
14 | end |
help da noob plz
Lego almost had it correct, but he made the mistake of using 'Character' as a descendant of Player. This won't work because 'Character' is actually a property.
So, to fix that, we'll simply change it up to this (In a LocalScript):
1 | repeat wait() until game.Players.LocalPlayer.Character --Makes sure that the Character is loaded in. |
2 | game.Players.LocalPlayer.Character.Humanoid.Died:connect( function () |
3 | script.Parent.Parent [ "Wasted01" ] .Visible = true |
4 | script.Parent.Parent [ "Wasted02" ] .Visible = true |
5 | wait( 2.50 ) |
6 | script.Parent.Visible = true |
7 | end ) |
And there you go. That's all he missed.
Don't forget to upvote Lego's answer, since I used and edited his script. If you have any further problems/questions, please leave a comment below. Hope I helped :P
Try this (In a local script)
1 | game.Players.LocalPlayer :WaitForChild( "Character" ).Humanoid.Died:connect( function () |
2 | script.Parent.Parent [ "Wasted01" ] .Visible = true |
3 | script.Parent.Parent [ "Wasted02" ] .Visible = true |
4 | wait( 2.50 ) |
5 | script.Parent.Visible = true |
6 | end ) |