local currentgame = script.Parent.Parent.Parent local menu = script.Parent local play = script.Parent.Play local quit = script.Parent.Quit local upgrades = script.Parent.Upgrades local quitmenu = script.Parent.Parent.Quit local upgradesmenu = script.Parent.Parent.Upgrades local gamemenu = script.Parent.Parent.Game if currentgame.Visible == true then if play.MouseButton1Down then gamemenu.Visible = true menu.Visible = false print 'clicked play' end end
When I load my game, it prints "clicked play" in the output and loads the "gamemenu" screen, and I never even clicked the button? Help would be very much appreciated!
This is because MouseButton1Down is not a boolean. A working way to do this would be to use MouseButton1Down as an event, because that's what it is.
currentgame = script.Parent.Parent.Parent -- all these don't need to be local, unless they are in a function or anf if statement or a loop. menu = script.Parent play = script.Parent.Play quit = script.Parent.Quit upgrades = script.Parent.Upgrades quitmenu = script.Parent.Parent.Quit upgradesmenu = script.Parent.Parent.Upgrades gamemenu = script.Parent.Parent.Game play.MouseButton1Down:connect(function()--eventy if currentgame.Visible then--no need for == true gamemenu.Visible = true menu.Visible = false print 'clicked play'--this stuff end end)
I hope i helped!