Keybind Animations don't work with UserInputService?
I've tried loads and loads of different methods to create key~bind animations, but none of them work. Even if I follow the tutorial It always shows the same error in output:
****Keycode Is Not A Valid Member Of InputObject...****
Can anyone help please? Here is the script if you need it:
01 | local plr = game.Players.LocalPlayer |
02 | local char = plr.Character |
03 | local human = char:WaitForChild( "Humanoid" ) |
04 | local uis = game:GetService( "UserInputService" ) |
05 | local anim = Instance.new( "Animation" ) |
08 | function onKeyPressed(inputObject, gameProcessEvent) |
09 | if inputObject.Keycode = = Enum.KeyCode.A then |
10 | human:LoadAnimation(anim):Play() |
11 | print ( "Animation is playing" ) |
14 | uis.InputBegan:Connect(onKeyPressed) |
I put the script in StarterGui, StarterPack... EVERYWHERE, is this a problem with my device or roblox studio?