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: GUI Show/Remove

Previous Thread :: Next Thread 
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:15 PM
I want to make a script that finds all children of StarterGui and basically removes them when you press g, then when you press g again the children of startergui come back

Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jul 2014 03:16 PM
startergui or playergui?
every player has their own gui so
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:18 PM
playergui, and when you press g it removes all the children of playergui, and if you press g again it comes back
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jul 2014 03:22 PM
i see
heres what i would do:

--when g is pressed
for k,v in pairs(player.PlayerGui:children()) do
v.Parent=game.ServerStorage:findFirstChild(player.Name)--work this out
end

and vise versa
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jul 2014 03:22 PM
--untested, if it doesnt do anything in solo then remove the second line

plr = game.Players.LocalPlayer
repeat wait() until plr -------second line
mouse = game.Players.LocalPlayer:GetMouse()
pGui = plr.PlayerGui
isVisible = true

function invis(par)
for _, v in pairs(par:GetChildren()) do
if v:IsA"GuiObject" then
v.Visible = false
end
invis(v)
end
end

function vis(pa)
for _, v in pairs(pa:GetChildren()) do
if v:IsA"GuiObject" then
v.Visible = true
end
vis(v)
end
end

mouse.KeyDown:connect(function(key)
if key:lower() == "g" then
if isVisible then
invis(pGui)
elseif not isVisible then
vis(pGui)
end
end
end)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jul 2014 03:23 PM
whats a guiobject :o
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:26 PM
doesn't work :(
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jul 2014 03:27 PM
do what i said
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jul 2014 03:27 PM
GuiObject is Frames, TextButton, TextBox, TextLabel, ImageLabel, and ImageButton.

Did you try removing the second line?
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:28 PM
@smiley

I mess up on adding code to scripts like this

srrrrrrrrrrrrrrrrrrrrrrrrryyyyyyyyyyyy
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:28 PM
Mhm. I removed the second line, still doesn't work. I put it as a local script, also.
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jul 2014 03:30 PM
plr = game.Players.LocalPlayer
repeat wait() until plr -------second line
mouse = game.Players.LocalPlayer:GetMouse()
pGui = plr.PlayerGui
isVisible = true

The_GUI = pGui. --EDIT THIS

mouse.KeyDown:connect(function(key)
if key:lower() == "g" then
if isVisible then
The_GUI.Parent = plr.Backpack
elseif not isVisible then
The_GUI.Parent = pGui
end
end
end)
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jul 2014 03:31 PM
The_GUI = pGu:WaitForChild("GUI NAME HERE")

replace the variable with this one^
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:32 PM
Sensei, can you make it so it finds all children of playergui so I don't have to type all the gui names and others?
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jul 2014 03:35 PM
plr = game.Players.LocalPlayer
repeat wait() until plr
mouse = game.Players.LocalPlayer:GetMouse()
pGui = plr.PlayerGui
isVisible = true

mouse.KeyDown:connect(function(key)
if key:lower() == "g" then
if isVisible then
for _, v in pairs(pGui:GetChildren()) do
v.Parent = plr.Backpack
end
elseif not isVisible then
for _, v in pairs(plr.Backpack:GetChildren()) do
if v:IsA"GuiObject" then
v.Parent = pGui
end
end
end
end
end)
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:39 PM
So..

I put it in workspace as a localscript?
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jul 2014 03:41 PM
not in workspace
in startergui
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:41 PM
I put it in workspace as a LocalScript and it doesn't work.
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:43 PM
I got it to work, but when I press g again my guis don't show again :(
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:46 PM
Read my comment above :(
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:48 PM
Bump again.
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 03:54 PM
You guys there?
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 04:18 PM
Smiley? :(!
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jul 2014 04:46 PM
Hey.

Erm, what's your script for making it appear?
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Jul 2014 05:04 PM
plr = game.Players.LocalPlayer
repeat wait() until plr
mouse = game.Players.LocalPlayer:GetMouse()
pGui = plr.PlayerGui
isVisible = true

mouse.KeyDown:connect(function(key)
if key:lower() == "g" then
if isVisible then
for _, v in pairs(pGui:GetChildren()) do
v.Parent = plr.Backpack
end
elseif not isVisible then
for _, v in pairs(plr.Backpack:GetChildren()) do
if v:IsA"GuiObject" then
v.Parent = pGui
end
end
end
end
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