Here's why:
* Clouds are opaque: Clouds are made of water droplets or ice crystals that are dense enough to block most of the light passing through them.
* Starlight is weak: While stars seem bright, their light is actually very faint when it reaches Earth. Clouds are much better at blocking this faint light than the brighter light of the sun or moon.
So, even though stars are still shining on a cloudy night, we can't see their light because it's being blocked by the clouds.