I made that like this (or somehow like this): Player distance is below 21 pixels -> Do 1 to variable EnemyAttackAnd when player distance is more than 21 pixels -> Do 0 to variable EnemyAttack.Then There was some timers somewhere. I made that a bit complicated way when I look at the events now, but I suggest you just try that and if that doesn't work, add and change events.