This is just off the cuff and may not work with your events, but someone else might be able to correct me or provide a better way. You could try adding an instance variable and calling it a STATE - text - . So as the player is walking SET the STATE to "WALKING" (with quotes), if Attacking, Set the STATE to "ATTACKING."
In your events you could try (Press (whatever your attack key is) add condition - player's STATE = Walking, (or that last part might need to be made in to a sub-event) and then add action attack animation.
The other thing you could try is create an event:
PLAYER IS MOVING (The platform icon that is moving)
Button is pressed > Add action>Play Attack animation.
I'm learning myself, but people here have been pretty helpful, so if this doesn't work, I'm sure someone will figure it out. Good Luck.