There’s a moment in “Good Boys” where the three protagonists — sixth-graders who have been best buds since kindergarten and think they’ll stay that way forever — learn that the real reason they became friends in the first place is simply that they lived in the same neighborhood.

Geography is the reason most early friendships start. You go to the same elementary school, you see each other every day at the bus stop, you spend your free time with a kid who lives next door or up the street. Aside from your family, that’s your whole world. But at some point, as you mature, you develop interests in other things or someone moves to another town or romance gets in the way.

That’s the only lesson to be learned in “Good Boys,” which is otherwise a comedy so raunchy the boys who star in it couldn’t go see it in a movie theater because of an R rating. They’re at the age where they believe they have a pretty good grasp on how the world works, but are seriously clueless about so much. In other words, they’re twelve years old. Much of the humor involves their naivet√© when it comes to girls, but also relies on a lot of cheap laughs involving sex toys of one kind or another, including a full-size doll they think is for learning CPR, which they use to try to master the art of kissing.

It’s a skill they don’t possess, but will need if they can achieve their goal of getting to a party at the house of one of the cool kids where, they’ve been told, there will be smooching of some kind. Before they go to the party, however, they have encounters with two high-school girls whose drugs they’ve inadvertently stolen, a cop at the end of his shift who just wants to go home, and some frat boys who look like they attend Movie Cliche College.

Gene Stupnitsky, who directed and co-wrote “Good Boys,” gets great comic timing out of his young stars, Jacob Tremblay (so good in “Room” and “Wonder”), Keith L. Williams, and Brady Noon. They’re a little bit younger than Wil Wheaton, River Phoenix, Jerry O’Connell, and Corey Feldman were in “Stand By Me,” but their chemistry and friendship are just as believable. There’s even a scene in which the boys have to cross a busy highway that’s analogous to the train bridge scene in Rob Reiner’s classic.

The difference between the two is one of tone. “Stand By Me” was full of pathos and relatability, while “Good Boys” relies on bad taste and idiocy for the sake of laughs. In that way, it’s more like “Superbad” — not surprising considering it’s from the Seth Rogen/Evan Goldberg formula factory. You can almost picture Stupnitsky and co-writer Lee Eisenberg sitting at a desk laughing hysterically at yet another inappropriate thing they’re going to have the boys to say or do (anal beads!). But that gets old the more they rely on it — which is a lot.

There’s a nice little story buried inside “Good Boys,” but it’s so covered with raunch that it gets lost. For that reason, I can only give the movie a 5 out of 10.