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:
local plr = game.Players.LocalPlayer
local char = plr.Character
local human = char:WaitForChild("Humanoid")
local uis = game:GetService("UserInputService")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://02762264324"
function onKeyPressed(inputObject, gameProcessEvent)
if inputObject.Keycode == Enum.KeyCode.A then
human:LoadAnimation(anim):Play()
print("Animation is playing")
end
end
uis.InputBegan:Connect(onKeyPressed)
I put the script in StarterGui, StarterPack... EVERYWHERE, is this a problem with my device or roblox studio?

2 comments
you might wanna load the animation above and set it as a variable, then play it
and also i would suggest to put the local script in starter character scripts.