Clash of Clans is a war game that takes place in a medieval-fantasy setting that includes magic and sorcery at the command of armies full of all kinds of bugs, and of course these armies must attack everything that moves in order to achieve short-term objectives, but these attacks must be regulated because otherwise some players would be at a serious disadvantage, especially those who spend a lot of time offline because they would be constantly attacked. That is where the shields come into consideration, then we will tell you what exactly they are for.
The shields are objects that are activated to prevent you from being attacked during the time they are active, and some you will have to buy them in the treasure shop, which is quite expensive (they cost a lot of gems) and others are activated automatically although for less time after receive a very aggressive attack to avoid being robbed of all resources quickly.