Does anyone know how to use the new KeyCode API? It's GetKeysPressed, but I don't know how to use it.
I would like it when the letter V is pressed, then I'll add my own code there.
Thanks, -flor
local uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(key,bool) if bool == false then if key.KeyCode == Enum.KeyCode.V then --do stuff here end end end)
Keep in mind this has to be done from a local script.
local uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(key, bool) bool = false if bool == false then if key.KeyCode == Enum.KeyCode.V then -- do stuff here bool = true end end end)
Both of ya'll are wrong. This is the correct way,
Here's the link: http://wiki.roblox.com/index.php?title=Keyboard_input
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.V then print("V was pressed") end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)