Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Are there any references to keyboard events?

Asked by 9 years ago

I'm basically asking for a link (like ROBLOX wiki) about scripting for KeyDown (I think this is what it's called? I really have little to no knowledge to the mouse and keyboard things)

Here are some examples I'm trying to figure out:

  • Basically How to even do it

  • How to make something happen, say you press Q without a tool/hopperbin equipped/selected.

  • How to do it with a tool/hopperbin

I'm not expecting a script or someone to teach me via answer, just a link so I can get started. I have little to no knowledge of this, so anything helps.

1 answer

Log in to vote
0
Answered by
Cizox 80
9 years ago

Using KeyDown events without having a HopperBin equipped: http://wiki.roblox.com/index.php?title=API:Class/Player/GetMouse

-Edit- An example of using this to access keys would be:

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.KeyDown:connect(function(key)

end)
0
A better explanation would be that the KeyDown event works through the mouse itself. Without the use of HopperBins, to get the mouse and access the KeyDown you would use this method. Cizox 80 — 9y
0
I think to check what key is pressed, I'd do something like if key:lower() == "q" then.... or something with byte? alphawolvess 1784 — 9y
0
key:lower() == "q" works just fine. Keys have byte codes that you could use in place of where the "q" is. Cizox 80 — 9y
Ad

Answer this question