Hi, I'm trying to use UserInputService to detect when the left shift key is pressed and released. I wrote this following some tutorials I found but whenever I try and use it I just get "Keycode is not a valid member of ImputObject." I don't know what I'm doing wrong and when I look for other tutorials it's just the same as what I'm already doing. This is inside a LocalScript within StarterPlayerScripts. I tried it in StarterCharacterScripts as well but it didn't make a difference.
local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input) if input.Keycode == Enum.KeyCode.LeftShift then print("Shift pressed") end end) UIS.InputEnded:Connect(function(input) if input.Keycode == Enum.KeyCode.LeftShift then print("Shift released") end end)
As LoveSpeaksOutTruth commented, I typed "Keycode" instead of "KeyCode".