Easiest solution imo: for (creep in Memory.creeps) { if (Game.creeps[creep]) {   // run creep;   } else { Game.spawns.Spawn1.createCreep([MOVE, WORK, CARRY], creep); }} This recreates your creeps and leaves the existing memory settings untouched.