Hi guys, I checked the wiki and it didn't give me much detail.. I want a Gui to pop up when the M key is pressed.
This is what I tried but to me it didn't make sense.
game:GetService("UserInputService"):IsKeyDown(109):connect(function() game.Players.LocalPlayer.PlayerGui.MenuGui.Frame.Visible = true end)
Could someone please tell me 1) If that code would work 2) How to use :IsKeyDown() properly please?
Many Thanks, Fahmi
IsKeyDown
is only for checking the current state of the keyboard. It isn't an event, it's a method.
You should read the wiki article on UserInputService
before you start trying things randomly. If you're confused on how to do things, you could try reading this blog post which covers being able to use your resources in order to help you make games more effectively.
You want to use the InputBegan
event of UserInputService
.
game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.M then gui.Visible = not gui.Visible end end)