I'm trying to make simple melee attack system, that works like: Player Hits Button > Animation Plays > On certain Frame Hitbox of Attack is activated > Things Happens. But, when u press button, only first frame is playing. Here is code:

#Attack if Input.is_action_pressed("ui_attack"): $Sprite.play("Attack") if (($Sprite.get_frame()) == 2) && ($Sprite.current_animation == "Attack"): $AttackHitBox.disabled = false else: $AttackHitBox.disabled = true

Full Script on PateBin

Reason: idle Animation is trying to play, and don't let to play attack animation. (Thx to guy from Russian Godot community)

Looking at the code posted, I don't see anything that would lead to the behavior you are seeing.

I would double check to see if the Attack animation on the sprite is defined, and would also check to see if somewhere else in your code is changing the animation before the attack animation has a chance to play.

Hopefully this helps! (Side note: Welcome to the forums!)

... changing the animation before the attack animation has a chance to play.

Actually, none other animation but Attack one not playing, while "Attack Button" is pressed.

And I not noticed anything that can "interrupt" animation. Full Script on PateBin

Found reason, It's happens because idle is always trying to play.

4 years later