Sorry to hear about your loss. Fish do not die for any reason. There are some causes. First I have a few question..
1. What type of filter do you have? If your filter is too small, then it will not be able to support the bioload. It is normally best to get a filter that is at least 1.5 times greater than the size of your current tank.
2. How long have you had this tank running? If the tank is only been running for less than a month, then the tank is still probably undergoing a cycle. When you introduce fish to a new tank, there is no benificial bacteria present yet. The benificial bacteria breaks down the ammonia (from fish waste and leftover food) into nitrITEs, then is converted to nitrATEs. This called the
Nitrogen Cycle. Any levels of ammonia and nitrITEs are dangerous to fish. Insufficient filtration could be the cause of this or a tank that is not cycled.
3. Your tank is overstocked.
Mollies can grow up to 4". The general
stocking guide is about 1" of fish for gallon of water, which I would like add, applies to fish under 3". Larger fish would be stocked at 1" of fish for each (at the most) 5 gallons of water. This is larger fish produce more waste, require additional swimming room, and at times, more aggressive. Having an overstocked tank will also lead to stressed fish, which leads to illnesses or worse, death.