Here you go, it was largely working, but there were just a few mistakes that I've fixed for you. You should have caught these yourself, though. Have you enabled script analysis and console output? If not, do. They're extremely useful for debugging scripts like yours. Also, PLEASE use a code block next time for your code.
The fixed code:
local Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
gui =
Open = false
function PressM(key)
if (key == "m") then
if (Open == false) then
gui.MenuPart.Visible = true
Open = true
elseif (Open == true) then
gui.MenuPart.Visible = false
Open = false
end
end
end
Mouse.KeyDown:connect(PressM)
Explanation: All you had wrong was some parentheses missing from the GetMouse function, which you could have easily debugged yourself. Again, script analysis and console is a must! A possible second reason is that you may have put this into a script, instead of a localscript, which would break the code as soon as you started a server. If you haven't already, put it into a localscript, inside of either the player's starterScripts or starterGui.
Hope this helped!
3 comments
shouldn't you have gui=script.Parent and Player:GetMouse()
Can you use code block it helps ppl read the code.
Delete what you have and paste the code in a code block, then I'll help you