The episode begins with the story of how Barney's life fell apart, but quickly bounces back to six hours earlier, when he's declaring that his life is perfect and is never going to change. That night, he and Robin will be having dinner with Loretta, Barney's mom. Robin is worried her mom won't deem her worthy. He has to drop off their catering deposit, before meeting his mom. It's $5,000 and a four-block walk on the Upper East Side, but Barney is not worried. As soon as he steps out the door, he's kidnapped for his surprise bachelor party by Ted and Marshall.
Barney is giddy and already smoking cigars. He's impressed by the kidnapping because for weeks he's been dubious about the duo's ability to plan his bachelor party. He calls Robin to tell her he's been kidnapped for a surprise bachelor party. He calls his mom to change plans and adds that Robin can't stand the idea of having dinner alone with her, but Loretta has just gotten to the table when this bit of information is shared. On Barney's end, though, the problem is solved. The guys are taking Barney to Atlantic City and the penthouse suite at the top of the Taj Mahal is almost, but not really, visible from the motel room they're actually staying in.
They thought it was better that they be away from the casino because of Barney's weakness for games of chance; a complicated Chinese card game, in particular. But 10 months earlier, he'd already told them everything he'd want for his "Bro Mitzvah." Robin calls Barney and wonders why Barney told his mom that Robin is a virgin. Loretta has dropped many subtle hints about this information, and has offered to give Robin a demonstration of how sex works using a breadstick and a napkin ring at the dinner table. Barney tells Robin that he panicked and told him mom she was a virgin.
Lily brings in the next request on Barney's list; an appearance by "The Karate Kid". Sure enough, Ralph Macchio walks in, but Barney is furious. He hates Ralph Macchio. "The Karate Kid," in Barney's world, is William Zabka, who played Johnny, star pupil of the Cobra Kai Dojo. Barney wants Ralph to leave, but Ralph says he's staying. Ted and Marshall see that Ralph Macchio and Barney are more alike than Barney thought. Finally, the stripper arrives; it's Quinn, who is suspicious that Barney is marrying Robin and Barney has questions, too. Quinn says she won't strip for Barney and Ralph Macchio is bummed because he was promised boobs. Lily offers, but Marshall pulls her back.
Quinn decides she'll strip for everyone there, except Barney. Next, it’s shown that Barney has been locked in the bathroom, while everyone else in the room is cheering. Robin calls Barney again and tells her that her night has been hell. Robin has finally told Loretta she's not really a virgin and that her napkin ring has seen plenty of breadsticks. Now Loretta is really opening up. She's holding up a napkin ring and three breadsticks, while talking about her night with Crosby, Stills and Nash. Loretta in the background asks for another breadstick. Barney comes out of the bathroom and calls the night off. He asks who needs a ride back to the city and everyone including Quinn, Ralph and the clown raises a hand.
Ralph Macchio makes another comment about how awesome his bachelor party was and mocks Barney for having his bachelor party so close to Atlantic City without gambling. Barney remembers the $5,000 in cash and makes a U-turn. At the casino, Barney loses the whole $5,000 and Quinn thinks it's funny that Barney didn't get to see her strip, but she just saw him lose his shirt. Ralph Macchio calls Barney a loser, but Barney vows to make the night legendary. He gets some credit and loses $80,000. Back in the car, Lily is still flirting with Ralph Macchio. He reminds her that her husband is right there, but he isn't. Barney tells her he used Marshall as collateral for the $80,000 credit.
Everyone is now upset with Barney. At the apartment, his friends leave and he finds Robin upset because she had to deal with his mother all night. Quinn arrives and asks Barney to pay for the night; Robin wonders why Quinn is there. Ralph Macchio spills the beans and Robin throws her ring at Barney, telling him it's over. Around the corner, Robin calls Ted and tells him, they’re right on schedule. Robin and Quinn then celebrate over the fact that Barney is suicidal. Old Ted says Barney had told them three weeks earlier that they’ll all disappoint him. Ted, Marshall, Lily and Robin then put their heads together. Marshall wondered how to make something memorable for a guy, who makes every night the best night of his life.
Robin suggested, giving him the worst night of his life. They as a result, gave him the worst hotel room, with the worst entertainment, the wrong "Karate Kid" and the absolute last stripper he would want to see. Quinn was more than happy to pretend she'd gone back to stripping and claim her life was crap just to screw with Barney. Barney would cut the night off early until his nemesis (Ralph Macchio) mocked him for not gambling in A.C. Robin also had the casino game rigged by the Chinese mob boss, who was also happy to mess with one of his former high rollers. Robin had even set up the idea of them taking either Ted or Marshall as collateral for the credit Barney would want.
Marshall and Ted debated about, who Barney would pick and Marshall was pleased it was him. Robin in the meantime, would set up Barney to think he'd left her to experience the worst night of her life with his mother. Loretta actually likes Robin and they've discussed this whole plan, too. They just needed the finale. Marshall is in the back seat of a Town Car driven by the Chinese mobsters. He sees Barney sitting on the stoop and begs him to pay them, but one says it's too late and cuts off an obviously fake hand with a cleaver and fake blood spews from the cut. Two mobsters grab Barney and drag him up to his apartment, where Robin, Quinn and everyone else are waiting.
Barney is nearly in tears when Robin tells him they decided to give him everything he wanted for his bachelor party without him even realizing it. Barney looks like he's about to cry, but eventually concludes that what his friends did for him was awesome. Later, Ralph Macchio makes a pass at Lily, who tells him her moves were all part of the act. Ralph Macchio claims he understands and offers Lily a platonic shake. They shake hands and as Ralph Macchio walks away, Lily licks her hand.
The clown then takes off his clown nose and starts wiping off his makeup and explains that Robin, who finally reached him after 18 voice mails told him that Barney, is one of the few people who really gets "The Karate Kid" movie. He proceeds to rip off the clown costume to reveal his Cobra Kai uniform and Barney yells "William Zabka" and hugs him. The episode ends at this point.