The logic where you assign unkillable variable is just a bit wonky. You're saying compare for each bullet if its own IID is equal to an IID in a random range, this could be true any number of times or never. You should instead set a local variable to floor(random(0,8)) and then set the bullet whose IID matches that number.