I'm making a menu GUI in my game, and would like to have them press M for it to open. I've tried a few times and can't grasp it. I'm really new to this and would like some help. Thanks :)
For more info about this type of stuff: https://developer.roblox.com/en-us/articles/Keyboard-Input-Methods Using the example from here, this is what I would do (localscript)
1 | function onKeyPress(inputObject, gameProcessedEvent) |
2 | if inputObject.KeyCode = = Enum.KeyCode.R then |
3 | game.Players.LocalPlayer.PlayerGui.replacewithgui.Enabled = true |
4 | end |
5 | end |
6 |
7 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |
Hope it helps, if it did be sure to accept the answer!