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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 03 Feb 2009 |
| Total Posts: 2574 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 24 Feb 2014 07:54 PM |
*Cough cough* Rbx.Lua *Cough Cough*
Carry on. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|