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

UserInputService For key pressed?

Asked by
Vezious 310 Moderation Voter
9 years ago

Since Keyboard Input is deprecated, how would you use UserInputService to see if someone has pressed /?

0
I know how to so it, but im not on laptop right now, if this is still unanswered when I am, I will answer you ScriptFusion 210 — 9y

1 answer

Log in to vote
5
Answered by 9 years ago

You can use InputBegan event.

game:GetService("UserInputService").InputBegan:connect(function(input,proc)
    if not proc and input.KeyCode == Enum.KeyCode.Slash then
        --code
    end
end)

'proc' is a variable that prevents input from getting accessed while typing in chat and similar.

For more information, check out these:

http://wiki.roblox.com/index.php?title=API:Class/UserInputService http://wiki.roblox.com/index.php?title=API:Class/InputObject http://wiki.roblox.com/index.php?title=API:Enum/KeyCode

0
If chat is disabled is proc still needed?, and would this work in a local?  Vezious 310 — 9y
0
Yes, it does work in Local. Not sure for the proc, but you should keep it. LetThereBeCode 360 — 9y
Ad

Answer this question