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

4 comments
Is your hierarchy correct?
It should have been, but I made it game.StarterGui etc etc to be sure. Didn't make the button work then.
Oh, and also, it's a LocalScript. That shouldn't affect anything right?
Local script is whats needed in this case.