As the first triggered ability tries to resolve, the spell that caused it to trigger and that spell’s targets are checked again. Ignore any target of the spell that has left the battlefield by that point. If all of the permanents you controlled that were targets have left the battlefield by that point, the triggered ability will do nothing and no token will be created. If at least one permanent you control that’s a target is still on the battlefield, the triggered ability will resolve, even if that permanent is now an illegal target for the spell.