Solid face masks, or facial coverings, are mainly to avoid the person from putting on the mask from producing droplets from breathing, coughing, sneezing, etc. It is these droplets that can bring out a virus from one person to another.
If you are infected, it is suggested to stay home and not go to public places even with a mask or facial covering on. However, surgical or hospital grade masks also provide protection from acquiring the virus from others and are combined with face shields for further droplet as well as eye protection. These types of personal protective equipment are used by medical workers.