For Halloween, Tina, Gene, and Louise plan to team up with Andy and Ollie Pesto and collectively wear a Chinese dragon costume, which they have gotten Bob and Linda to construct, in a ploy to get twice the usual amount of candy. Tina announces that she plans not to go trick-or-treating the next year, believing that as a teen she has outgrown the activity. Before they go back to the family restaurant to claim their costume, the five, accompanied by their friend Darryl, decide to make a stopover at the Belcher siblings' makeshift cardboard fort, located in a neighboring alley. However, a truck backs up and blocks the fort's entrance and roof, with the driver, Dennis unaware that the children are inside. Once they realize that he will be leaving the truck parked in the alley for the night, they begin to scream for help. Only Millie Frock, an annoying classmate of Louise's, overhears them and comes to their rescue. Louise, however, becomes increasingly annoyed by Millie's talkativeness and eventually lashes out at her, causing Millie to keep them stuck in the fort.
As the day continues, Millie continues to torment her trapped schoolmates, first by dropping plastic spiders through the fort's walls. Louise rips through some soggy cardboard, which reveals a passageway into an adjacent dumpster. Ollie is sent through first, but Millie closes the dumpster on him before he can escape and get help. It emerges that Darryl told Millie of their escape plan in exchange for candy and a trip to the bathroom, only for her to betray him. Night falls and Bob and Linda, noticing that their children have not yet arrived to pick up their costume, decide to investigate the fort. Millie, however, deceives them into believing that the children have already gone trick-or-treating.
Darryl discovers that he can use a bent wire hanger to press a button on the truck which will lift up its loading ramp off the roof, allowing them to escape. However, he presses the wrong button, which causes the ramp to instead move down onto the fort. They stack up bricks and paint cans from the dumpster to stop themselves from being crushed to death and the force begins to tear the fort's doors, allowing the children to crawl free. However, they are disappointed to find that the lights have been turned off in every house.
Tina, Gene, and Louise go home and decide to eat the candy obtained by Bob and Linda, who went trick-or-treating in the dragon costume. Tina says that she will continue to trick-or-treat after all. Millie later passes by the alley and is horrified to see the crushed remains of the fort, believing that she has killed her schoolmates. The Belcher siblings, hiding on top of the truck, pretend to be spirits and trick Millie into forfeiting her candy. As the credits roll, Tina, Gene, Louise, Andy, Ollie, and Darryl are seen eating Millie's candy.