I need to know how to activate the menu in my game with the m key. Please help.
COMMUNITY QUESTION
Activate a GUI by pressing a key?
1 answer
If you mean making a GUI Visible, this should work:
local uis = game:GetService("UserInputService") -- Get the UserInputService.
local ui = script.Parent --Define ScreenGui
local frame = ui.Frame --Define Frame
uis.InputBegan:connect(function(inputObject) -- Function fires when any input from your device is recieved, where inputObject is an Instance with a Child containing information about the key, button or anything else.
if inputObject.KeyCode == Enum.KeyCode.E then -- If statement that checks if the KeyCode is E
frame.Visible = true
end
end)
Read more here: http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputBegan
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
what do i put it in ?
A local script. With line 3 edited to be the path of the frame. I urge you to read this, joshmatt1245: http://wiki.roblox.com/?title=Scripting_Book