I found the problem... For some reason it refused to work in my textbutton, but when I deleted it and put in a new text button with the same script it worked perfectly.
This is how I do it
01 | Open = false |
02 | script.Parent.Mousebutton 1 Click:connect( function () |
03 | Gui = script.Parent.Parent.NAMEOFYOURGUI |
04 | --Just an example, if I wanted the shop to open when clicked |
05 | if Open = = false then |
06 | Open = true |
07 | elseif Open = = true then |
08 | open = false |
09 | end |
10 | end ) |
For GUI's you do not use click detectors like you would in a part, instead you would use:
1 | script.Parent.MouseButton 1 Down:connect(onClicked) |
This triggers when the left mouse button is pressed.
Make sure the script is inside the button rather than the click detector when you fix it!
Take a look at this:
http://wiki.roblox.com/index.php/Beginner's_GUI_Tutorial#Buttons