The Wiki says KeyDown is deprecated, so what do I use now?
✓ ANSWER ACCEPTED
What should I use now that KeyDown is deprecated?
2 answers
✓ Accepted answer
You could use this
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
print("R was pressed")
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.R)
-- The above line could also been written as:
-- game.ContextActionService:BindAction("keyPress", onKeyPress, false, "r")
Or this
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
print("R was pressed")
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
UserInputService is good, like Yellow said, so go ahead and learn about that service.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
UserInputService! ~~~ too tired to answer
Oh, ok. I think I should do more research on that service.
Can i use that service in plugins?
UserInputService only runs in LocalScripts. LocalScripts do not run in plugins. Therefore, do /not/ use UserInputService for plugins. For your purposes, KeyDown is perfectly OK.