Animation problem

Hello. I’m trying to make smooth animation transition when player moving.

There’s the issue, when i’m walking right, and then pressing W to move forward, my animation still going right.
Gyazo with issue:

That’s the code i’m using right now.

if Input.KeyCode == Enum.KeyCode.D then = "rbxassetid://4942312563"
elseif 	Input.KeyCode == Enum.KeyCode.W then = "rbxassetid://4942126061"
elseif 	Input.KeyCode == Enum.KeyCode.A then = "rbxassetid://04942487845"
elseif 	Input.KeyCode == Enum.KeyCode.S then = "rbxassetid://04942488918"

I don’t know any other alternatives, so if you know, i would be grateful if you tell me about the others.
Also sorry for my bad English

Hello, I couldn’t fully understand the problem

Hello, i’m trying to make something like this

The id written on the script is the same as in this video?

Did you load the animations into the Humanoid? I believe just changing the AnimationId will not run the animation, for what I have done in the past, is load the actual animation before playing it. Sort of like how sounds work in Roblox, you can :Play(), :Stop(), :Pause(). For animations, you can do the same, however you need to load the animations in first. A great example of loading the animations in would be found here:

In the “Playing Animations Directly”, it shows an example in which you load the animation into the humanoid, before actually playing it.