You should look into this post!
It includes pretty much everything you should know.
Here is what I think you’re tryna do.
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local UIS = game:GetService("UserInputService")
local Playing = false
local Animation = ANIMATION_HERE
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.K then
if not Playing then
Playing = true
local Anim = Humanoid:LoadAnimation(Animation)
Anim:Play()
else
Anim:Stop()
end
end
end)