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.
✓ ANSWER ACCEPTED
OnClick function for GUI text button not working?
2 answers
✓ Accepted answer
This is how I do it
Open = false
script.Parent.Mousebutton1Click:connect(function()
Gui = script.Parent.Parent.NAMEOFYOURGUI
--Just an example, if I wanted the shop to open when clicked
if Open == false then
Open = true
elseif Open == true then
open = false
end
end)
For GUI's you do not use click detectors like you would in a part, instead you would use:
script.Parent.MouseButton1Down: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
This discussion is preserved as it was. New answers, comments, and votes are closed.

8 comments
Awesome, thank you!
Still not working. The entire "mousebutton1down" function seems to just not work.
Where have you put the script?
local script, by itself in the playergui folder
startergui*
I just tried it and it worked fine, I put the script in the same place and everything.
Wait, it doesn't need something like 'script.Parent.MouseButton1Click:connect(onMouseClick)' type of deals on the bottom does it? Because the wiki mentions nothing of the sort
I noticed I had it way down at the bottom of the list of gui parts and not directly in the folder, my bad. But I need it to work without creating new instances but I can't figure out how :l