If John Hughes were alive today and set one of his high-school movies in Inglewood, the suburb southwest of Los Angeles, rather than Shermer, the fictional town north of Chicago, the result might be something like Rick Famuyiwa’s “Dope,” a brisk, funny tale in neo-Hughes mode about three put-upon pals who unwittingly and unwillingly get involved in the drug trade. It’s edgier than Hughes’ pictures ever were, of course—the passage of two decades have seen significant cultural change—but it has much the same affectionate perspective on teen misfits, and even ends with a personal statement reminiscent of the one Brian Johnson (Anthony Michael Hall) delivered at the close of “The Breakfast Club”—though this time, of course, it’s delivered on video rather than paper.

What sets the plot in motion recalls another eighties Hall movie, “Out of Bounds,” in which the actor played Daryl Cage, an Iowa farm boy who mistakenly wound up in L.A. with a duffel bag full of drugs and found himself pursued by its real owner. Here the pertinent piece of luggage is a backpack owned by Malcolm (Shameik Moore), a nerdy type who, along with his pals, skateboarder Jib (Tony Revolori) and Diggy (Kiersey Clemons), the girl who’s often mistaken for a boy, has adopted a determinedly retro style, complete with a flashback hair style and a fascination for the hip-hop music of the nineties.

Malcolm’s smart and well-behaved—his single mom (Kimberly Elise), a bus driver, sees to that—but also the target of the campus bullies. That’s why it’s almost miraculous when, trying to evade them one day, he’s treated almost chummily by local drug dealer Dom (A$AP Rocky), a young hustler who uses the kid as a go-between with his strong-willed girlfriend Nakia (Zoe Kravitz). He also invites him to a party at a club, though the boy’s under age. When the bash is invaded by armed thugs after Dom’s merchandise, he stashes it—along with a gun—in Malcolm’s backpack and tells the kid and his friends to vamoose.

When he discovers the drugs, Malcolm wants only to get rid of them. But Dom’s in jail, and a mysterious caller who demands their return turns out to be a dangerous gangbanger. The trio’s efforts to resolve the predicament take them to the house of a couple of wacked-out rich kids, Lily and Jaleel Jacoby (Chanel Iman and Quincy Brown) and, after a riotous chase through the streets of Inglewood (including a pit stop that goes viral), to their father Austin (Blake Guenveur Smith), a neighborhood entrepreneur who also happens to be the alum assigned to interview Malcolm for his application to Harvard. Jacoby strongly suggests to Malcolm that he’d better make the matter right by selling the drugs, which takes him to Will (Blake Anderson), a frizzy-haired motor-mouth who just happens to be an expert hacker who helps him quickly master the recesses of the Internet and the mysteries of Bitcoins. And amid all that Malcolm finds time to develop what at first seems an unlikely relationship with Nakia, who has ambitions of her own.

This is a very busy scenario, and Famuyiwa, cinematographer Rachel Morrison and editor Lee Haugen have worked together to keep it relatively clear—particularly for tech savvy viewers, who will be better equipped to deal with the computer jargon of its later stages—as well as energetic and quick. The cast fit into the equation snugly, with Moore likable and credible as a kid so straight-arrow that the guards at the school don’t even bother to frisk him when he sets off metal-detectors (they assume the machines are broken) or is barked at by drug-sniffing dogs, and accept his explanations for why he and his friends are spending long hours in the chemistry lab. Revolori and Clemons don’t get as many opportunities to shine, but they’re amiable companions, while Anderson, Brown and Iman all go for broke and get big laughs in the process. Kravitz makes a strong-willed romantic interest, and A$AP Rocky is surprisingly loose as the guy who sets everything in motion. The movie also benefits from the hip-hop fueled soundtrack (with some original songs by Pharrell Williams and a background score by Germaine Franco), Scott Falconer’s ace production design and Patrik Milani’s frequently witty costumes.

The movie does occasionally get preachy—in that culminating Harvard application video, for example, or in a discussion of who’s allowed to use the “n” word. But that’s Hughesian, too; his pictures always included episodes that went suddenly serious. And it’s no more fatal here than it was in the 1980s. It also begins with a listing of the various meanings of “dope.” One, of course, involves the illegal substances that become the driving force of the plot. But in street slang the word also means “cool” or “awesome.” So it wouldn’t be far off the mark to suggest that “Dope” is dope.