I have seen games where you press "E" to eat and stuff, is there a thing I could use to detect what players press on their keyboards?
✓ ANSWER ACCEPTED
How would i detect what a player presses on the keyboard?
2 answers
✓ Accepted answer
You can use the UserInputService !
http://wiki.roblox.com/?title=API:Class/UserInputService
Example:
game:GetService("UserInputService").InputBegan:connect(function(input,proc)
if not proc then --checks if not using chat
if input.KeyCode == Enum.KeyCode.E then
--Do stuff.
end
end
end)
hope this helped! ~KIHeros :) (If it did please accept!)
An easier way of doing that ^..
wait()
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
print(key)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
it says that InputBegin is not a valid member of UserInputService
sorry I always make this mistake its input began