Transparent shader for closest face

Hey guys- when using a Standard transparent shader, I am noticing that it is rendering faces that would normally be obscured. For instance, I can see the inside brim of my character’s hat.

Imgur

Is there a way to make a transparent shader exclude faces that would normally be obscured? For instance: the inside of my character’s hat and back of his ears would not be visible with an opaque shader. Basically I want an opaque shader that has an alpha applied to it

Also I’m a total noob at writing shaders, so any help is much appreciated!

This is one solution:

But why is that kid using a transparent shader at all? He looks completely opaque to me. If you need him to become transparent to fade in and out, the above technique will work, although there is some overhead in terms of performance.