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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
| |
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 16 Jul 2014 03:31 PM |
The_GUI = pGu:WaitForChild("GUI NAME HERE")
replace the variable with this one^ |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 16 Jul 2014 03:41 PM |
not in workspace in startergui |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
| |
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
| |
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
| |
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
| |
|
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
|
  |
| 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 |
|
|