Remember that _physics_process() is a continuous while loop that runs while the game is running.
Inside it, you can check Input.is_action_just_pressed() and add them to an Array as @gertkeno suggests.
What you are asking is actually a lot more complicated than just how to buffer it, but I thought it’d be fun to implement. so I took an hour and a half and made you an example project with an animated character that has light and heavy attacks, moves, supports keyboard, mouse, and controller. I put in two special attacks. One is growing to a large size and kicking. The other is shooting a fireball.
The character and background are free from Craftpix.net. The fireball is free from NYKNCK on Itch. The sound effects are from Ovani and I paid for them. I recommend them for all your sound needs. (Which means anyone downloading this project cannot legally reuse them without buying them from Ovani.)




