Hard water often contains salts of calcium and magnesium. Soap molecules react with the salts of calcium and magnesium and form a precipitate. This precipitate begins floating as an off-white layer over water. This layer is called scum. Soaps lose their cleansing property in hard water because of formation of scum.