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: Remove Gui after key is pressed again

Previous Thread :: Next Thread 
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 05:05 PM
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
key = key:lower()
if key == "e" then --key
function GetGui()
for i, v in pairs(script:GetChildren()) do
if v:IsA("ScreenGui") then return v end
end
return nil
end
Gui = GetGui()
Gui.Name = script.Parent.Parent.Name .. "GUI"
script.Parent.Parent.Changed:connect(function() GetGui().Name = script.Parent.Parent.Name .. "TalkGui" end)
while true do wait(.1)
for i, v in pairs(game.Players:GetChildren()) do
if v.Character ~= nil then
if v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude <= 5 and v.PlayerGui:FindFirstChild(Gui.Name) == nil then
Gui:Clone().Parent = v.PlayerGui

elseif v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude > 5 and (script.Parent.Position - v.Character.Torso.Position).magnitude < 7 then
if v.PlayerGui:FindFirstChild(Gui.Name) then v.PlayerGui[Gui.Name]:Remove() end

end
end
end
end

end
end)

------------

Okay, so I need the Gui to go away after "E" is pressed again.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
15 May 2014 05:07 PM
if active == true then
--make it close here
else
--make it open here
end
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 05:50 PM
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
script.Parent.OpenGui.Visible = true
key = key:lower()
if key == "e" then --key
if active == true then
function GetGui()
for i, v in pairs(script:GetChildren()) do
if v:IsA("ScreenGui") then return v
end
return nil
end
Gui = GetGui()
Gui.Name = script.Parent.Parent.Name .. "GUI"
script.Parent.Parent.Changed:connect(function() GetGui().Name = script.Parent.Parent.Name .. "TalkGui" end)
while true do wait(.1)
for i, v in pairs(game.Players:GetChildren()) do
if v.Character ~= nil then
if v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude <= 5 and v.PlayerGui:FindFirstChild(Gui.Name) == nil then
end
Gui:Clone().Parent = v.PlayerGui
if OpenGui == Visible then
script.Parent.textlabel.text = ("Press [E] to close the information screen")
key = key:lower()
if key == "e" then
script.Parent.Name:Remove()


elseif v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude > 5 and (script.Parent.Position - v.Character.Torso.Position).magnitude < 7 then
if v.PlayerGui:FindFirstChild(Gui.Name) then v.PlayerGui[Gui.Name]:Remove() end

end
end
end
end

end
end)


---------

I added in a part that's supposed to remove the "opengui", a screengui with a textlabel that tells the player to press E and also added in something that changes opengui's text, which made this more confusing..

and now end) is underlined in red and output keeps spamming me -_-

Help?
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 05:59 PM
Should I incorporate stringvalues with the text into this? I think that's what I should do.

But how do I use those strings to affect OpenGui's test? it's all under the one main script posted..

stringvalue values:

EOPEN: Press [E] to open the information screen

ECLOSE: Press [E] to close the information screen

----------------------

And even if I figure out how to incorporate them, how will it affect the entry and leaving of opengui, and opengui's affect on the InfoGUI's entry and leaving?
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
15 May 2014 06:05 PM
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(k)
if k:lower() == "e" then
game.Players.LocalPlayer.PlayerGui.GuiNameHere.FrameNameHere.Visible = not game.Players.LocalPlayer.PlayerGui.GuiNameHere.FrameNameHere.Visible
end)
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
15 May 2014 06:06 PM
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(k)
if k:lower() == "e" then
game.Players.LocalPlayer.PlayerGui.GuiNameHere.FrameNameHere.Visible = not game.Players.LocalPlayer.PlayerGui.GuiNameHere.FrameNameHere.Visible
end
end)

--forgot an end
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 06:13 PM
Thanks cool, but two questions

1: where do I add that script
2:is it for opengui or just for getting the infogui to close?
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 10:17 PM
Bump.. even though I'll probably be ignored
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 10:26 PM
Why am I being ignored.. is it because I'm not good at this?
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
15 May 2014 10:35 PM
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
script.Parent.OpenGui.Visible = true
key = key:lower()
if key == "e" then --key
if active == true then
function GetGui()
for index, t in next, script:GetChildren() do
if t:IsA("ScreenGui") then return v
end
return nil
end
Gui = GetGui()
Gui.Name = script.Parent.Parent.Name .. "GUI"
script.Parent.Parent.Changed:connect(function() GetGui().Name = script.Parent.Parent.Name .. "TalkGui" end)
while true do wait(.1)
for index,v in next, game.Players:GetPlayers() do
if v.Character ~= nil then
if v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude <= 5 and v.PlayerGui:FindFirstChild(Gui.Name) == nil then
end
Gui:Clone().Parent = v.PlayerGui
if OpenGui == Visible then
script.Parent.textlabel.text = ("Press [E] to close the information screen")
key = key:lower()
if key == "e" then
script.Parent.Name:Remove()


elseif v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude > 5 and (script.Parent.Position - v.Character.Torso.Position).magnitude < 7 then
if v.PlayerGui:FindFirstChild(Gui.Name) then v.PlayerGui[Gui.Name]:Remove() end

end
end
end
end

end
end)

What is the error message?
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
15 May 2014 10:46 PM
Unexpected ")" near end
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
16 May 2014 06:34 AM
Bump
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
16 May 2014 06:41 AM
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
script.Parent.OpenGui.Visible = true
key = key:lower()
if key == "e" then --key
if active == true then
function GetGui()
for index, t in next, script:GetChildren() do
if t:IsA("ScreenGui") then return v
end
return nil
end
Gui = GetGui()
Gui.Name = script.Parent.Parent.Name .. "GUI"
script.Parent.Parent.Changed:connect(function() GetGui().Name = script.Parent.Parent.Name .. "TalkGui" end)
while true do wait(.1)
for index,v in next, game.Players:GetPlayers() do
if v.Character ~= nil then
if v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude <= 5 and v.PlayerGui:FindFirstChild(Gui.Name) == nil then
end
Gui:Clone().Parent = v.PlayerGui
if OpenGui == Visible then
script.Parent.textlabel.text = ("Press [E] to close the information screen")
key = key:lower()
if key == "e" then
script.Parent.Name:Remove()


elseif v.Character:FindFirstChild("Torso") ~= nil and (script.Parent.Position - v.Character.Torso.Position).magnitude > 5 and (script.Parent.Position - v.Character.Torso.Position).magnitude < 7 then
if v.PlayerGui:FindFirstChild(Gui.Name) then v.PlayerGui[Gui.Name]:Remove() end

end
end
end
end
end
end
end)


Another error?
Idk, i just guessed this.
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
16 May 2014 06:47 AM
le boomp
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
16 May 2014 05:29 PM
b
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
16 May 2014 05:46 PM
why do you guys hate me
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
17 May 2014 10:46 AM
b
Report Abuse
NotGonnaHappenKids is not online. NotGonnaHappenKids
Joined: 29 Apr 2014
Total Posts: 11
17 May 2014 10:48 AM
key = key
if key pressed then
gui get removed
end of script
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
17 May 2014 11:47 AM
um


vague
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
17 May 2014 12:58 PM
b
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
17 May 2014 07:07 PM
Seriously..
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
17 May 2014 07:52 PM
B
Report Abuse
Gybro is not online. Gybro
Joined: 23 Apr 2014
Total Posts: 808
17 May 2014 09:04 PM
Come on.
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