I've been having trouble making TextButtons work. I know how to script a bit, but the buttons just aren't working. I probably have messed up a Connection line or something. Here's my code:
ScreenGui = script.Parent.Parent.Parent Button = script.Parent ShopBG = ScreenGui.ShopBG Button.MouseButton1Clicked:connect(function(onClick) if ShopBG.Visible == false then ShopBG.Visible = true elseif ShopBG.Visible == true then ShopBG.Visible = false else print("An error has occured with the Shop Opening Script.") end end)
The script is just to open the Shop when you click a Button. When I click it, nothing happens.
Screenshot of my Hierarchy: http://gyazo.com/3a7c744ee52af2dc1d4c7a7a024882ed
All you need to do is take 'onClick' out of line 5. You can't put parameters into a connect statement directly, and that's not a parameter anyways. The resulting line should look like this
Button.MouseButton1Click:connect(function() --also, you needed click, not clicked.