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: GUIs and CoreGUIs disabled on death?

Previous Thread :: Next Thread 
Castlemore is online. Castlemore
Joined: 15 Sep 2013
Total Posts: 14737
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 is not online. DEVMAC101
Joined: 01 May 2013
Total Posts: 856
28 Oct 2014 09:35 PM
Any output errors?
Report Abuse
Castlemore is online. Castlemore
Joined: 15 Sep 2013
Total Posts: 14737
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 is not online. 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 is not online. 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
Castlemore is online. Castlemore
Joined: 15 Sep 2013
Total Posts: 14737
28 Oct 2014 10:07 PM
Doesn't work @noah
Report Abuse
noah is not online. noah
Joined: 11 Sep 2006
Total Posts: 18977
28 Oct 2014 10:14 PM
Works for me.
Report Abuse
noah is not online. 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
Castlemore is online. Castlemore
Joined: 15 Sep 2013
Total Posts: 14737
29 Oct 2014 07:08 AM
That doesn't work either. I changed it myself.
Report Abuse
Castlemore is online. Castlemore
Joined: 15 Sep 2013
Total Posts: 14737
29 Oct 2014 08:33 AM
b
Report Abuse
Enzo01234 is not online. 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 is not online. 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
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