School's out at Third Street School, but T.J. is upset because his friends have all decided to go to various camps to plan for their futures. T.J. unhappily rides around town, doing things by himself. He even very reluctantly agrees to hang out with the school snitch Randall. On his way there, he notices something going on at the school. T.J. sneaks inside and finds the school using a tractor beam to levitate a safe. Panicked, he tries to tell his parents and the police, but they do not listen. When he gets Principal Prickly to come to see what's going on, he is electrocuted and dematerialized just as he attempts to unlock and open the door, leaving only his shoes behind as evidence. T.J. is now frustrated because his parents won't listen and neither will the police. He decides he has to round up the gang and uses his sister Becky's diary to blackmail her into driving him to all the camps to pick up his friends.
T.J. and his friends steal a box of documents, but filled with no information, T.J's friends then accuse him of making up an idea just to bring them back. T.J. tells them he really did see Prickly disappear but Gus points out that Prickly had just got into a car and driven off. They are about to head back to their camps when they see the tractor beam come out of the school and shoot out a green laser and agree that something is going on in the school. The gang have a stakeout at T.J.'s treehouse and enjoy eating snacks and singing a song they first heard after they were in Kindergarten. The next day, T.J. finds Prickly's golf pants in a dumpster and also sees the bald guy he saw guarding the school pull off a mask of Principal Prickly's face, showing that this was indeed him pretending to be Prickly when Gus pointed out the other Prickly getting into a car.
The gang finds a note in the pocket of Prickly's golf pants saying "HELP ME!" on it; this makes T.J. and his friends decide to break into the school to save him. Randall eavesdrops on this and inform assistant teacher Miss Finster, who then plans to catch the gang trying to break the school. While there, they are caught spying by the gaurds and are forced to flee, an act witnessed by a shocked Randall and Finster, who then wonders what exactly is going on in the school. T.J., on the other hand, is captured and is put in a storage room where he finds the real Prickly, all tied up in thick ropes to a chair and his mouth gagged. The bald guy's boss named Dr. Phillium Benedict enters the room to interrogate them.
After Benedict leaves, Prickly reveals that he and Benedict were best friends. He also stated that Miss Finster used to date with Benedict. Prickly then explains his story, back in the spring of 1968, Benedict became the principal of Third Street School. During a private conversation with Prickly, Benedict showed him that he had intended a move to abolish recess as a way to improve test grades. Needless to say, Benedict's plan didn't go well, as it was met with a protest of angry parents. Since Benedict refused the parents' plea to reinstate recess, Prickly went to the superintendent as a means of convincing Benedict to change his mind. Despite the superintendent assuring the parents that Benedict's no-recess policy will not be put into motion, Benedict refuses to back down, which then incited the superitendent to demote him and promote Prickly to principal. Shocked, Benedict blames Prickly for taking his job, which then caused a disgusted Finster to break off her relationship with Benedict for his lack of common sense. Upset, Benedict quit his job as a teacher, swearing vengenace on him. Later on, Prickly says Benedict went into politics and became Secretary of Education, only to be fired by the President when he tried to abolish recess nationwide.
Using the vent ducts, T.J. and Prickly head to Prickly's office, where T.J. recovers his walkie-talkie (which Prickly confiscated from T.J. last week) and tells his friends Benedict wants to destroy summer vacation after seeing painted graffiti on his wall, indicating so. However, T.J. and Prickly are caught by the bald guy again before T.J. could explain further. T.J.'s friends go through the box of documents again. Spinelli finds a date book that says lunar perigee (which happens to be 12:22 the next afternoon) on it; Gretchen deduces that Benedict is trying to move the moon's orbit via tractor beam when it is closest to the Earth, which as a result, will create a new Ice Age. Benedict reveals to T.J. and Prickly that his ultimate plan is to put the world in an eternal state of winter so that kids will be forced inside to study year round.
T.J.'s friends get Becky to drive to the camps again, where they pick up all the children. Gus draws up the plans to attack the school. T.J. and Prickly escape the cage that Benedict has imprisoned them in, as Prickly swiped up the keys when Benedict wasn't even looking. Gus' plan works, and most of Benedict's guards and ninjas are knocked out or captured. After reuniting with T.J. and Prickly, the kids storm the auditorium, only for another set of guards to restrain them as Benedict prepares to pull the lever. However, Finster arrives to the rescue, bringing the teachers and staff to help stop Benedict for good. A battle ensues between Benedict's men and the students and staff. During the battle, the bald guy tries to punch T.J. in the face for bathing him in corn chowder, but Finster knocks him out. Prickly then punches Benedict in the face to stop him from trigger the beam, but as Benedict slumps, he triggers the beam and Prickly cannot reverse it. T.J. tosses his baseball to Vince, whose accurate aim destroys the device, much to the students and staff's delight. Following the aftermath of the battle in the school, Benedict and his men are arrested on the charges of theft, attempted terrorism, and breaking into the school.
T.J.'s friends inform him they intend to spend the rest of their summer with him, and T.J. gives Becky her diary back to thank her. T.J. then rushes into Prickly's office to thank him, only to be thanked back by Prickly for reminding him of why he went into teaching in the first place: to help kids. T.J. runs off with his friends, while Prickly puts on his peace symbol necklace from 1968, and tells T.J. he did not forget about the "saggy butt comment" he had made during a prank early in the film. But T.J. tells him September is a long way off. The film ends with T.J. and his friends running off to enjoy the rest of their summer vacation.
Andrew Lawrence as Theodore Jasper "T.J." Detweiller
Rickey D'Shon Collins as Vince LaSalle
Jason Davis as Mikey Blumberg (speaking voice)
Robert Goulet as Mikey Blumberg (singing voice)
Ashley Johnson as Gretchen Grundler
Courtland Mead as Gus Griswold
Pamela Adlon as Ashley Spinelli
Dabney Coleman as Principal Peter Prickly
James Woods as Dr. Phillium Benedict
Peter MacNicol as Fenwick
April Winchell as Miss Muriel Finster / Mrs. Detweiller
Paul Willson as Mr. Detweiler
Melissa Joan Hart as Becky Detweiller
Ryan O'Donohue as Digger Dave / Randall C. Weems
Allyce Beasley as Miss Grotke
Dan Castellaneta as Guard #1
Tony Jay as Dr. Rosenthal
Nicholas Turturro as Cop #1
Kevin Michael Richardson as Cop #2
Clancy Brown as Bald Guy
Robert Stack as Superintendent
Erik von Detten as Captain Brad
R. Lee Ermey as Colonel O'Malley