Olivia Milch's directorial debut follows four best friends struggling to prepare for the real world, aided by bawdy comedy and big emotion.

The first time we see Lily (Lucy Hale) and her tight-knit pack of pals hotboxing her car, it’s played for laughs, a giddy act of rap-infused rebellion before the foursome (including Kathryn Prescott, Alexandra Shipp, and rapper-turned-actress Awkwafina) make their way into yet another raucous party. The second time, it’s a year later, and all that joy is gone, replaced with four sad-eyed seniors sparking up in the hopes of getting through another grinding day at their crunchy high school. The tragedy that scars the girls — which first-time filmmaker Olivia Milch doesn’t try to hide or sugarcoat — looms large over the rest of the film, an otherwise raunchy stoner comedy about misbehaving teenage girls that could make a banger of a double feature alongside Kay Cannon’s similarly R-rated girl-powered feature, “Blockers.”

But while “Blockers” reveled in the bond between its central friends, “Dude” is more occupied with pulling apart those friendships, stretching them until they snap, and seeing what’s left over. Milch and co-writer Kendall McKinnon don’t actively buck humorous situations — the film is a comedy at its heart, deep, deep down — but there’s a dark underpinning to everything that happens in “Dude,” even when it’s overlaid with bawdy jokes and filthy situations. The hotboxing is the first indication that something is about to go off the rails, the sudden death of a peripheral character is another, and that’s just the start of more trouble to come.

Milch’s film puts an unexpected twist on a played out formula, the teen comedy about those last great days of high school before everyone goes their separate ways. Individually heartbroken over a tragedy that played out at the end of their junior year, Lily and her beloved “dudes” — including her best pal Chloe (Prescott), the hilarious Amelia (Shipp) and Rebecca (Awkwafina), seem bent on keeping up appearances even as they’re struggling to take the next step. Chloe is harboring desires to stay close to home, while Lily is obsessed with the notion that they head off to college together in NYC. Amelia is boy crazy and impossible to rely on, while Rebecca is consumed with a crush on a teacher (meant to be funny and sweet, it’s a subplot that really misses the mark).

They’ve been friends forever, but is that enough to keep them together for the long haul? (In the real world, the answer is of course “no,” but “Dude” amiably grapples with it for the film’s slim 90-minute running time.)

Despite assembling a stellar cast of known and rising stars (Awkwafina will next be seen in “Ocean’s 8,” which Milch, herself a talent on the rise, wrote alongside director Gary Ross), “Dude” too often opts to keep them apart, even before the foursome begins to show uncomfortable cracks. Brief scenes that see the gals hanging out, often fueled by weed and a healthy teenage disdain for the world, are way too short-lived, spinning them off into their own orbits and just begging the audience to care about their crumbling bond. You should care, they’re great together, but even “Dude” seems to forget that far too often.

At least the bulk of the film’s attention is aimed at Lily, played by Hale as an over-the-top Type A personality who struggles to cede control to anyone around her and happy sputters lines like “prom is my prom date!” with ease. Lily is hiding her pain — okay, yes, for a comedy, there’s a lot of pain here — through her rigorous student council activities, increasingly dead-eyed appearances at still more parties, and even a dalliance with a younger (and just as dedicated!) member of the prom planning committee. The only thing that really matters to Lily is her dudes, especially Chloe. As she holds them closer (it’s very “Of Mice and Men”), they only slip further away.

Hale is already engaging enough in the role before “Dude” plunges headlong into darker territory (yes, it’s still a comedy!) that further threatens to split the central foursome apart. The film might revel in its raunchy bits, from out-of-control parties to an eye-popping approach to sexual freedom, but as it digs deeper into the emotional aspects of their bond, it adopts a much stronger sensibility. Early in the film, one character comments that “life stops,” but the message of “Dude” is just the opposite: life never stops, even when you’re having fun, and especially when you’re not.

Grade: B-

“Dude” will be available to stream on Netflix starting on Friday, April 20.

Sign Up: Stay on top of the latest breaking film and TV news! Sign up for our Email Newsletters here.