|
| 05 Jun 2016 09:07 PM |
Tying to make a gui appear when you die. Won't work. Thanks in advance.
Code Below.
local plr = game.Players.LocalPlayer local gui = game.StarterGui.ScreenGui local txt = gui.TextLabel local char = game.Workspace.Player1
function sequence(text) text.Visible=true wait(1) text.Visible=false wait(1) text.Visible=true wait(1) text.Visible=false wait(1) text.Visible=true wait(1) text.Visible=false wait(1) text.Visible=true wait(1) text.Visible=false wait(1) end
char.Health.Changed:connect(function() if char.Health==0 then gui:Clone().Parent=plr.PlayerGui if plr.PlayerGui:findFirstChild("ScreenGui") then sequence(plr.PlayerGui:findFirstChild("ScreenGui").TextLabel) end end end) |
|
|
| Report Abuse |
|
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 09:11 PM |
Using Local scripts to do things when the player dies is a little problematic because the local scripts typically get reset, or the character that they are referencing does, and all that nasty voodoo.
Why doesn't this work? What are the errors, or what does it do that you don't want it to do?
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 09:11 PM |
| Error Says 22:05:31.353 - Player1 is not a valid member of Workspace |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 09:20 PM |
Change it to
char = player.Character
|
|
|
| Report Abuse |
|
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 09:22 PM |
or, plr.Character, as you have it referenced. <3
|
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 05 Jun 2016 09:42 PM |
| use PlayerGui instead of StarterGui btw |
|
|
| Report Abuse |
|
|