I tried making a crouch animation that plays when you press left ctrl on the keyboard. I was expecting it to work, but it doesn't.The animation is for the player. And yes, it is an r15 animation. Any help is appreciated!
So I am trying to make it so when you press left control, a specific animation plays, but it is not working and it keeps getting me an error: "Attempt to index nil with WaitForChild". I tried different things and even if it doesn't give me an error, the script is still not working. It is a LocalScript inside of StarterPlayerScripts and any help would be appreciated. Maybe it's something easy to fix but I am a beginner and I really don't know what to do.
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animation = script.Animation
local animationtrack = animation:LoadAnimation(animation)
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
animation:Play()
end
end)