Hi guys! Any ideas why this isn't working? (It is not opening the gui) thanks :)
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() gui = script.Parent.Menu.Frame Open = false function PressM(key) if (key == "m") then if (Open == false) then gui.Visible = true Open = true elseif Open == true then gui.Visible = false Open = false end end end Mouse.KeyDown:connect(PressM)
It is a localscript in the startergui!
Roblox recently deprecated KeyDown. From now on you will have to use the UserInputService in order to detect key pressing or mouse clicks. It actually makes it more difficult now to detect key pressings but I have fixed your script so that it should work. If you have any further questions or this does not work, please let me know.
Player = game.Players.LocalPlayer gui = script.Parent.Menu.Frame game:GetService("UserInputService").InputBegan:connect(function (input, _) if input.KeyCode == Enum.KeyCode.M then if gui.Visible == false then gui.Visible = true else gui.Visible = false end end end)