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: Help with a script that creates a GUI.

Previous Thread :: Next Thread 
KeolaOwnz is not online. KeolaOwnz
Joined: 03 Feb 2009
Total Posts: 2574
24 Feb 2014 04:45 PM
So, I am very new to Lua, and I have been making a lot of posts. But I am learning. So thanks a bunch to you guys.

Anyways, I am trying to create a script that creates my GUI on the player's screen when he steps on a pad. The pad already has an ontouch function, and I am making the GUI as we speak. How would I go about creating the GUI on the screen by stepping on a pad?
Report Abuse
ALERIFICALNEUMORAITI is not online. ALERIFICALNEUMORAITI
Joined: 21 Nov 2010
Total Posts: 302
24 Feb 2014 04:59 PM
--This script should go inside of the stepped part
local guiPointer = nil --change this to the location of your GUI in the game (game.Workspace.Gui, for example)

script.Parent.Touched:connect(function(hit)
--When any part touches the brick, it triggers this function; now we have to find a player from this given part

local player = game.Players:GetPlayerFromCharacter(hit.Parent) --try to match a player with the part's parent, a leg would be inside of a player's character model

if player then
guiPointer:clone().Parent = player.PlayerGui --simple as that
end

end)
Report Abuse
KeolaOwnz is not online. KeolaOwnz
Joined: 03 Feb 2009
Total Posts: 2574
24 Feb 2014 05:30 PM
Thanks a lot! Lua is so much different than Java in a way. Creating things in java was easier, but I love the hierarchy/tree system is roblox lua. I have a lot to learn. I will try it and get back to you if I have an issue!
Report Abuse
KeolaOwnz is not online. KeolaOwnz
Joined: 03 Feb 2009
Total Posts: 2574
24 Feb 2014 05:58 PM
SO I am also stuck yet again on a script that forces the GUI to close. Here is what I have, but it doesn't work:

TITLE = script.Parent.Parent.Parent
GUI_BUTTON = scipt.Parent

GUI_BUTTON.MouseButton1Click:connect(function()
TITLE:Destroy()
end)
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
24 Feb 2014 06:02 PM
TITLE = script.Parent.Parent.Parent
GUI_BUTTON = scipt.Parent

GUI_BUTTON.MouseButton1Click:connect(function()
TITLE.Transparency = 1
end)

SO I am also stuck yet again on a script that forces the GUI to close. Here is what I have, but it doesn't work:
Report Abuse
KeolaOwnz is not online. KeolaOwnz
Joined: 03 Feb 2009
Total Posts: 2574
24 Feb 2014 06:21 PM
It's not working. Is it because I have it in starterGUI? If so, how do I get it into the PlayerGUI? It needs to be displaying for the player only once, but has to be up as soon as he or she enters the game.
Report Abuse
KeolaOwnz is not online. KeolaOwnz
Joined: 03 Feb 2009
Total Posts: 2574
24 Feb 2014 07:06 PM
Bump
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
24 Feb 2014 07:09 PM
You need to clone the GUI from ServerStorage to the player when they join.

http://wiki.roblox.com/index.php/PlayerAdded_(Event)
Report Abuse
KeolaOwnz is not online. KeolaOwnz
Joined: 03 Feb 2009
Total Posts: 2574
24 Feb 2014 07:53 PM
I know about Clone(), but how would I clone the GUI using this? Lua is very new to me, I am really sorry.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Feb 2014 07:54 PM
*Cough cough* Rbx.Lua *Cough Cough*

Carry on.
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
24 Feb 2014 07:56 PM
Before I even look at this, you made a typo
GUI_BUTTON = scipt.Parent
should be
GUI_BUTTON = script.Parent
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Feb 2014 07:57 PM
TITLE = script.Parent.Parent.Parent
GUI_BUTTON = script.Parent

GUI_BUTTON.MouseButton1Click:connect(function()
TITLE.Visible = false
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