I'm unaware why your code would be behaving the way you describe it is.. perhaps you have caps lock on? I don't know, but i'm going to suggest an alternative method for you.
Use UserInputService, with the InputBegan function.
The InputBegan function listens for ANY user input.. and it returns what user input was, well, inputted. So what you can do with this function is compare the returned value(the parameter)'s KeyCode with a KeyCode Enum, like; Enum.KeyCode.M.
local uis = game:GetService('UserInputService')
local gui = script.Parent.Menu.Frame
uis.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.M then
gui.Visible = not gui.Visible
end
end)
1 comment
Thanks very much! But it still doesn't work :( I do not have Caps lock on and it only works with Shift and M again :( :( Any ideas? It is so weird? I have tried loads of different ways :(