If the target spell is an illegal target when Mana Sculpt tries to resolve, it won't resolve and none of its effects will happen. You won't add mana at the beginning of your next main phase. If the target is legal but not countered (probably because an effect says that spell can't be countered) and you control a Wizard, you'll still add mana.

Artwork
Loading artwork…
Mana Sculpt
Secrets of Strixhaven · #57 · EN
Nonfoil—Foil—
Card rules
Counter target spell. If you control a Wizard, add an amount of
equal to the amount of mana spent to cast that spell at the beginning of your next main phase.
The harder a foe strikes, the stronger a Dragonsguard's defenses become.
Rare · Illustrated by Cristi Balanescu
Format legality
Alchemy Legal
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Future Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Penny Legal
Pioneer Legal
Standard Legal
Standard Brawl Legal
Timeless Legal
Tlr Legal
Vintage Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
PreDH Not Legal
Premodern Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions