I need a more efficient method for a stun system

Currently in the making of a game, and I need to know how to make a more efficient stun system.

Here’s how it works:

  1. Player hits Victim
  2. Insert a Value into the Victims “StunFolder”
  3. If the Victim tries to click check for a stringvalue inside of “StunFolder” named “Stun”
  4. If there is a value the player can not click, and is slowed down a bit. They also can not jump.

This system is 80% good, 20% of the time the player can jump out of some of the attacks, and their animation for attacking may play before being hit again. It’s the split second that there’s no values that makes the player free to move, punch, and jump.

I’m not sure I understand steps 3 and 4, do you think you could rephrase what you’re trying to say a bit? Also, why do you need the folder? It might be better to detect the hit in a server script, then do the actions a stun would do within the same script.

Nevermind I figured it out. All is good.

Could you please explain how you figured it out? I seem to be having the same issue.