make player inable to deal damage to someone minecraft
I made a mechanism where if you get hit, you get hit by lightning. However all the redstone freezes and stays on if you spam it. Because it test if you have stat.damageTaken and if it is 1 or higher it executes lightning at all players with score of one or higher. However I can't do /scoreboard players reset @a isHit
fast enough because I need a delay for the lightning going away. However during the delay, a player can hit the other player again and spam it freezing the redstone. Is there away to make it reset instantly or make the player unable to hit for a few ticks? I prefer the 2nd one becuase it makes it less OP for a custom PVP map I am making
I think editing your redstone is ultimately a better solution, however if you do want to stop a player from being able to do damage, I believe using a high level Weakness status effect actually yields 0 damage:
/effect @p 18 3 255 true
This should render the targeted player unable to do damage for 3 seconds (Change the 3 to any number of seconds as required) The true at the end also hides the particle effects, so it shouldn't be too noticeable to the player.
Structure of command:
/effect <player> <effect> [seconds] [amplifier] [hideParticles]