|
| 23 Jan 2017 01:15 PM |
Hi, I'm trying to make a script(s) where, when you touch a part, a gui will appear, which can be closed. I've managed to fully complete the bit where you close the gui, but I cant seem to figure out how to use Touched:connect to open the GUI. Here's the script.
#code game.Workspace.itemStoreDetector.Touched:connect(function(GUIopen) #code game.StarterGui.ScreenGui.Enabled = true #code end)
Any help would be appreciated, thanks.
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:17 PM |
Maybe use
function onClicked(playerWhoClicked) |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:18 PM |
That'd work, but I'm trying to do a Touched event. I'll try it anyways though. Wouldn't I need to insert a ClickDetector tho?
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:19 PM |
| To be honest I'm not that great either but yes I think so |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:20 PM |
U may need this
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:20 PM |
| Don't know what order the stuff goes in though |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jan 2017 01:25 PM |
Don't worry, I know how to use onClicked lol. Also, it's still not working. It can't be a script issue, I'm getting no errors in the output box so it must be something with the GUI. Thanks for the help. :)
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jan 2017 01:26 PM |
| If so put it in starter gui |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:27 PM |
The GUI opener isn't a GUI, it's a part. But to close it the GUI needs to be open. And yes, it is in starter GUI. :)
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jan 2017 01:28 PM |
Basically, in my game there's a store. Infront of the store, there is a transparent part, with the clickdetector and the script to open the GUI inside. The actual GUI is in StarterGUI.
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jan 2017 01:30 PM |
It's fine dude. Atleast you tried to help. :)
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:31 PM |
| Soz I couldn't be more of help is there anyone who can help him? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 23 Jan 2017 01:44 PM |
"game.StarterGui"
use player gui after you get the player from hit
|
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:45 PM |
??? Not sure what you mean? As in, replace starterGui with playerGui?
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 23 Jan 2017 01:47 PM |
dont use the #code
workspace.ItemStoreDetector.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then local gui = player.PlayerGui:WaitForChild('ScreenGui') gui.Enabled = true end end)
|
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 01:49 PM |
Thanks for the script. I'll test it out now.
#code print "Hello World!" |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2017 02:04 PM |
It worked! Thanks so much dude!
#code print "Hello World!" |
|
|
| Report Abuse |
|
|