The flies are most likely fungus gnats, which are attracted to decaying plant material in the soil. To get rid of them, remove any old leaves or plant matter from the surface of the soil, and allow the top inch or two of soil to dry out completely before watering again (as is recommended for aloe plants anyway). Place a bowl of apple cider vinegar near the plants and add a few drops of dish soap to the vinegar to break the surface tension. The gnats will be attracted to the vinegar and become trapped. Refresh this bowl every couple of days until you no longer see flies.
The flies are most likely fungus gnats, which are attracted to decaying plant material in the soil. To get rid of them, remove any old leaves or plant matter from the surface of the soil, and allow the top inch or two of soil to dry out completely before watering again (as is recommended for aloe plants anyway). Place a bowl of apple cider vinegar near the plants and add a few drops of dish soap to the vinegar to break the surface tension. The gnats will be attracted to the vinegar and become trapped. Refresh this bowl every couple of days until you no longer see flies.