Okay so I am trying make a open and gui script. This is what I have and it only works in studio but not in the actual game, I don't know what I could've did wrong :/. But can I also use this as Image Button instead?
local Button = script.Parent
Frame = script.Parent.Parent.Parent.BuyCash
function onClick()
if Frame.Visible == false then
Frame.Visible = true
elseif Frame.Visible == true then
Frame.Visible = false
end
end
Button.MouseButton1Click:connect(onClick)

4 comments
Or can I make this into a simple way of coding it?
Not sure what you did wrong, but you can rewrite this so it's more succinct: "Frame.Visible = not Frame.Visible"
ScrewDeath is correct. Also switch to Connect since connect is deprecated
Are you error checking in-game? It could be as simple as using WaitForChild in case your "BuyCash" frame doesn't exist during the execution of the script.