Dear student
Hard water contains salts of calcium and magnesium.
When soap is added to hard water, calcium and magnesium ions present in water displaces sodium or potassium from soap molecules forming white insoluble precipitates which appear as sticky and called as scum. This scum leaves a deposit on clothes, skin, and hair.
Regards