How can i make a quick time event?

Im trying to make an sword fighting game, And add a parry system, If a player parries one of the enemy’s attack, they both will enter a quick time event, and play an clashing animation, on where they have to press an certaint button on their keyboard as fast as they can, the person that pressed the button the most times will win the quick time event. And make an killing manuever to defeat the enemy.

All help will be appriciated!

  1. UserA enters the input to swing their sword
  2. UserB enters the input to parry that attack
  3. The attack casts a ray and finds the state that the UserB is currently in is a parry state, so the quick time event is fired
  4. Both clients are alerted through a remoteEvent and the given function is called
  5. After x amount of seconds, those results are sent back to the server
  6. The winner is drawn by matching the numbers.

what if the client exploited it so their result always read that they won the qte?

By saying state you mean position?

The client could exploit the result anyway due to the nature of such an event on the client, the only thing that we can really do is put in place sanity checks.

A state is what the humanoid is currently doing and describes their task. For example if they’re running their state “id” so to speak is 8, which refers to movement on the humanoid. A parry state would just be the humanoid parrying. Using these states helps developers keep their code managed, easy to read, maintainable and expandable.

Ah, I see. Well, Now here’s another problem. How do i make an parrying, clashing animation, during the quick time event?

if you press a button you will play a parry animation and a boolvalue that says “isparrying” then do all the quick time event stuff