Difficult without the project file but you I would stop the function from being called every tick, for example by the time you start the 0.2 second timer the function has been called for the same enemy hundreds of times and it queues up. I would get rid of the attack variable and the 0.5 seconds, use the timer itself to lock out the function call event into a run once only when the timer is not running.