Hi guys! this script works but only if I press Shift and M making it an uppercase. Any ideas?? Thanks
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() gui = script.Parent.Menu.Frame Open = false Mouse.KeyDown:connect(function(key) if string.lower(key) == "m" then gui.Visible = not gui.Visible end end)
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
.
--UserInputService local uis = game:GetService('UserInputService') --Gui local gui = script.Parent.Menu.Frame --InputBegan uis.InputBegan:connect(function(input) --Compare KeyCodes if input.KeyCode == Enum.KeyCode.M then --Toggle visibility of gui gui.Visible = not gui.Visible end end)