How to play an animation when pressing a key

Hi gdevelop community,
I hope you are doing great…community I need your help… i want my player to do an animation whenever I press a key… and I tried with variables but it doesn’t work … So please help me with this… Hope I will get a perfect solution :relaxed:

no it will not diana… i want my player to do sword attack animation with a key press… please comminity help

Hi, but @L_e_m_o_n_T_e_a is right. As a condition you choose a key and as an action you play your animation (it is the “Change the animation” action).

I did but my player stuck in first frame of the animation when I press the attack key so I need help and want to complete my player’s attacking animation by pressing the key.

Drona bro help karo please

Please refrain from spamming threads, even your own.

As far as your question, you’re very likely missing “Trigger once”, so your animation is being reset every frame.

You could use the search function.
It is the most commonly asked problem.
The answer is trigger once