1 of 2

No idea on how to use Attacks of Opportunity

So, i'm a new DM and my friends are new too so we are trying to get familiar with the rules, one that we can't get is the one on attacks of opportunty, my friends say that you get one every single time a monster attacks because "If he attacks, then gets to lower his guard" but I find that unfair because they will get 2 attacks every single time.