I'm making a game that has a start menu in it. I want that GUI to disappear upon the player clicking the "Start Game" button, but it currently doesn't do anything when you click the button.
Here's my code:
local button = script.Parent local toggled = false local guiObj = ScreenGui local function onButtonActivated() if toggled == false then guiObj:Destroy() else button.Text = "Start Game" toggled = false end end button.Activated:Connect(onButtonActivated)
Any tips would be appreciated, thanks! :)
local button = script.Parent local guiObj = game.StarterGui.ScreenGui button.MouseButton1Click( function() guiObj:Destroy() button.Text = "Start Game" end )
local button = script.Parent local guiObj = ScreenGui local function onButtonActivated() if guiObj.Enabled == false then guiObj.Enabled = true elseif guiObj.Enabled == true then guiObj.Enabled = false end end button.Activated:Connect(onButtonActivated)