Menu doesn't do open and close

I created GUI that opens and close the menu, but it doesn’t work. Whether I tried to make a boolean value, but it doesn’t work either. So, I followed to watch my video to see its bugs:

There is a script that doesn’t work:

local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui

local menuButtonGui = script.Parent
local settingsGui = playerGui.SettingsGui
local teleportGui = playerGui.TeleportGui
local animationGui = playerGui.AnimationGui
local feedbackGui = playerGui.FeedbackGui

local toggleMenu = menuButtonGui.ToggleMenu
local toggleSettings = menuButtonGui.ToggleSettings
local toggleTeleport = menuButtonGui.ToggleTeleport
local toggleAnimation = menuButtonGui.ToggleAnimation
local toggleFeedback = menuButtonGui.ToggleFeedback
local toggleAudio = menuButtonGui.ToggleAudio

toggleMenu.Activated:Connect(function()
	
	local show = menuButtonGui.Show.Value
	
	if show == false then
		show = true
		toggleSettings.Visible = true
		toggleTeleport.Visible = true
		toggleAnimation.Visible = true
		toggleFeedback.Visible = true
		toggleAudio.Visible = true
	elseif show == true then
		show = false
		toggleSettings.Visible = false
		toggleTeleport.Visible = false
		toggleAnimation.Visible = false
		toggleFeedback.Visible = false
		toggleAudio.Visible = false
	end
	
end)

toggleSettings.Activated:Connect(function()
	settingsGui.SettingsFrame.Visible = not settingsGui.SettingsFrame.Visible
end)

toggleTeleport.Activated:Connect(function()
	teleportGui.TeleportFrame.Visible = not teleportGui.TeleportFrame.Visible
end)

toggleAnimation.Activated:Connect(function()
	animationGui.AnimationFrame.Visible = not animationGui.AnimationFrame.Visible
end)

toggleFeedback.Activated:Connect(function()
	feedbackGui.FeedbackFrame.Visible = not feedbackGui.FeedbackFrame.Visible
end)

toggleAudio.Activated:Connect(function()
	playerGui.AudioGui.AudioFrame.Visible = not playerGui.AudioGui.AudioFrame.Visible
end)

How do I make a script that menu can open and close?

local show = menuButtonGui.Show.Value

toggleMenu.Activated:Connect(function()
	
	if show == false then
		toggleSettings.Visible = true
		toggleTeleport.Visible = true
		toggleAnimation.Visible = true
		toggleFeedback.Visible = true
		toggleAudio.Visible = true
        show = true
	else
		toggleSettings.Visible = false
		toggleTeleport.Visible = false
		toggleAnimation.Visible = false
		toggleFeedback.Visible = false
		toggleAudio.Visible = false
        show = false
	end	
end)
1 Like

Thanks for the help, I’m so happy to work now!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.