|
| 28 Oct 2014 09:34 PM |
-[[ But not the death GUI.
Please fix this for me, I've tried for ages with no luck. ]]
sp=script.Parent p=game.Players.LocalPlayer
-----
function DeleteGui() for _,v in pairs(p.PlayerGui:GetChildren()) do if not v.Name == 'Death' then v:Destroy() game.StarterGui:SetCoreGuiEnabled('All',false) end end end
-----
if p.Character.Humanoid.Health == 0 then DeleteGui() end
-----
if p.Character.Humanoid.Health == 100 and not p.PlayerGui.Intro.Frame.Visible == true then game.StarterGui:SetCoreGuiEnabled('All',true) end |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
| |
|
|
| 28 Oct 2014 09:37 PM |
02:36:56.231 - sp=script.Parent p=game.Players.LocalPlayer
-----
functio:17: attempt to index global 'p' (a nil value) |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
|
| 28 Oct 2014 09:42 PM |
LocalPlayer is a read-only property of Players.
In order for this to work, you must specify the player you want to remove the Gui from.
|
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 28 Oct 2014 10:02 PM |
LocalScript
local Player = game.Players.LocalPlayer game.StarterGui:SetCoreGuiEnabled('All',true) Player.Character.Humanoid.Died:connect(function() game.StarterGui:SetCoreGuiEnabled('All',false) for _,v in pairs(p.PlayerGui:GetChildren()) do if not v.Name == 'Death' then v:Destroy() end end end) |
|
|
| Report Abuse |
|
|
| |
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
| |
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 28 Oct 2014 10:15 PM |
Oh I forgot to change p to Player when I copied your code
local Player = game.Players.LocalPlayer game.StarterGui:SetCoreGuiEnabled('All',true) Player.Character.Humanoid.Died:connect(function() game.StarterGui:SetCoreGuiEnabled('All',false) for _,v in pairs (Player.PlayerGui:GetChildren()) do if not v.Name == 'Death' then v:Destroy() end end end) |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2014 07:08 AM |
| That doesn't work either. I changed it myself. |
|
|
| Report Abuse |
|
|
| |
|
Enzo01234
|
  |
| Joined: 24 Mar 2011 |
| Total Posts: 6131 |
|
|
| 29 Oct 2014 09:32 AM |
local Player = game.Players.LocalPlayer game.StarterGui:SetCoreGuiEnabled('All',true) Player.Character.Humanoid.Died:connect(function() game.StarterGui:SetCoreGuiEnabled('All',false) for _,v in pairs (Player.PlayerGui:GetChildren()) do if not v.Name == 'Death' then v:Destroy() end end end)
noah's code works
local script into starterpack will do it
[-★-] Our Unit shall rise again |> www.roblox.com/My/Groups.aspx?gid=869728 ] |
|
|
| Report Abuse |
|
|
Enzo01234
|
  |
| Joined: 24 Mar 2011 |
| Total Posts: 6131 |
|
|
| 29 Oct 2014 09:38 AM |
Nevermind, only in studio.
[-★-] Our Unit shall rise again |> www.roblox.com/My/Groups.aspx?gid=869728 ] |
|
|
| Report Abuse |
|
|