Hello! I was wondering how to make the M key in my keyboard get you back to the main menu of the game. I tried using two scripts for this. Script #1: (Disables Main MenuGui, with music, blur effect, and camera if you click on Play (In this case my game is an FPS, so it's a Deploy Button))
-- Variables
local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local mouse = player:GetMouse()
local camera = game.Workspace.Camera
local defualtCFrame = camera.CFrame
local view = 150
local blur = game.Lighting.Blur
blur.Size = 11
-- Scripting in Action
function updateCamera()
camera.CFrame = game.Workspace.MenuCamPart.CFrame
end
game:GetService("RunService").RenderStepped:Connect(updateCamera)
script.Parent.MenuFrame.DeployButton.MouseButton1Click:Connect(function()
wait(0.2)
blur.Size = 0
game.Workspace.MenuMusic:Stop()
camera.CameraType = Enum.CameraType.Custom
script.Parent.MenuFrame.Visible = false
script.Parent.AntiCameraScript.Disabled = false -- Script #2
script.Disabled = true -- Script #1
end)
Then I have Script #2 (Re-enables Main MenuGui, with music, blur effect, and camera if you press the "M" key on your keyboard)
-- Variables
local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local UIS = game:GetService("UserInputService")
local camera = game.Workspace.Camera
local defualtCFrame = camera.CFrame
local view = 150
local blur = game.Lighting.Blur
-- Scripting in Action
local function onInputBegan(input, gameProcessed)
if input.UserInputType == Enum.KeyCode.M then
wait(0.2)
blur.Size = 11
game.Workspace.MenuMusic:Play()
camera.CameraType = Enum.CameraType.Custom
script.Parent.MenuFrame.Visible = true
script.Parent.CameraScript.Disabled = false
script.Disabled = true
end
end
UIS.InputBegan:Connect(onInputBegan)
Script #1 works perfectly fine, but Script #2 doesn't. Would someone like to help me? Thanks, I'll be waiting for your answers!

4 comments
Did you mean blur.Size = Udim2.new(1,0,1,0)? or 11,11,11,11.
No, I meant how to use the UserInputService to make "M" bring you back to the main menu of the game.
Ok, when the event fires, do the same thing as you did when the menu pop up. Try share the code which makes the main menu visible and ill modify a little bit
There is no event