Captain Underpants and the Attack of the Talking Toilets is the 2nd book in the Captain Underpants series.
Jerome Horwitz Elementary School is going to hold its second annual Invention Convention. Students George Beard and Harold Hutchins remember how at the last Invention Convention, they pulled a prank on the school that caused everyone to be super-glued to their seats. This year, however, because the winners of the Invention Convention get to be principal for a day, they decide to take it seriously.
Unfortunately, their Principal, Mr. Krupp wants to avoid a fiasco like last year's and bans George and Harold from the Invention Convention, forcing them to stay in the study hall all day. They decide to secretly sabotage everyone's inventions in revenge after realizing that this isn't fair.
While sneaking in to sabotage the inventions, they run into Melvin Sneedly, the Jerome Horwitz Elementary School brainiac. Melvin is working late on his invention, the PATSY 2000, which is a photocopier that turns two-dimensional objects into three-dimensional objects. To demonstrate, he puts in a photo of a mouse and a real mouse comes out.
George and Harold however do not believe that the PATSY 2000 can turn two-dimensional objects into three-dimensional objects. They promise not to sabotage Melvin's invention as long as he promises not to report them for what they are doing. Melvin, looking at his invention, states he promises to keep it a secret.
Thanks to George and Harold, the Invention Convention is a disaster and everyone in the school gets covered in slimy goo from the sabotaged inventions such as a dog washer shooting black ink at everyone instead of water at the dog, eggs shot from a shooter instead of ping-pongs and a sack of pudding from a volcano detector. The convention is called off and Mr. Krupp thought that he put George and Harold in Study Hall. However, Melvin Sneedly breaks his promise and tattles on George and Harold. As punishment, Mr. Krupp puts George and Harold in detention for the rest of the year. From now on they must write a sentence he wrote on every chalkboard in the detention room completely within 2 hours. He also threatens them if any of them leave the detention room for any reason before their 2 hours are up, he'll suspend both of them.
George and Harold quickly finish their detention work thanks to some rods that they created in George's dad's workshop. They then start to write a comic called "Captain Underpants and the Attack of the Talking Toilets" in which the Amazing Captain Underpants defeats millions of vicious talking toilets and their leader, the Turbo Toilet 2000. George suggests making copies of their new comic book for tomorrow, but Harold states they can't do that since Mr. Krupp will suspend them if he finds they had left. George states they'll just have to stay out of his sight.
George and Harold however find out there are teachers in the teachers' lounge, so that means they can't get to the copy machine. George and Harold then remember the invention Melvin made and they decide to use that to make copies of their comic book George and Harold still think that Melvin just crammed a mouse in there to fool them.
Unfortunately, the PATSY 2000 really does turn two-dimensional objects into three-dimensional objects, so the evil, vicious talking toilets come to life. George and Harold run out of the gym, but they get caught by Mr. Krupp for leaving the detention room and he declares they are suspended. They try to explain what occurred in the gym, but Mr. Krupp doesn't care or listen since they're suspended. He orders them to get out of the school for good and take their stuff with them. Before George and Harold can leave, the other teachers get the news and decide to notify their parents and throw a party in the gym for having George and Harold suspended. George tries to stop them from opening the door, but they don't listen, due to the fact that George and Harold are suspended. Once Mr. Meaner opens the door, one toilet gets out and swallows him. The toilets break out of the gym and attack everyone in the school. Thanks to Ms. Ribble snapping her fingers at a toilet, Mr. Krupp turns into Captain Underpants, who comes up with a plan to stop the Talking Toilets. George and Harold chase after him as Captain Underpants takes several pairs of underwear from unsuspecting clotheslines. The Boy who sees everything is seen again.
Once they are back at the school, Ms. Ribble is shown running away in terror from the toilets relying on Captain Underpants for help. Right after C.U. claims he won't let them hurt her, a toilet eats her as he stated his word. George, Harold, and Captain Underpants get surrounded quickly, so C.U. tries shooting some underwear at the toilets, but they just eat the underwear and only seem to become hungrier. The gang head to the cafeteria and find cream chipped beef as tomorrow's lunch. They then head outside and use the underwear as a slingshot to shoot the cafeteria food into the Talking Toilets' mouths. Since it is disgusting cafeteria food, the Talking Toilets die (but not before they spit out all of the teachers). Harold says that seemed easy, but George notes that it seemed way too easy to be true. Harold doesn't understand what he means. George shows the comic book they made and points out that everything on the front cover of the comic book was supposed to be brought to life by the PATSY 2000. Although they have seen the Talking Toilets themselves, George says they haven't seen the Turbo Toilet 2000 yet.
The Turbo Toilet 2000 bursts out of the school (He was turned to life like all the other Talking Toilets, but was previously unseen.). He is aware that his toilet army is defeated, but our heroes have no more cafeteria food so they can't use that to stop him. Captain Underpants then battles him instead. After a quick battle, the Turbo Toilet 2000 swallows Captain Underpants whole! With Captain Underpants out of commission, the TT 2000 states his next diabolical plan but George proclaims that they aren't done fighting just yet. George and Harold sneak into the school and locks the doors to prevent the TT 2000 from getting in. The duo then uses Melvin Sneedly's machine to make a super-powered robot who does whatever they say known as The Incredible Robo-Plunger (Originally Harold suggested a giant robot urinal called the Urinator, but George disagreed since the writers will never let them get away with that in a children's book).
The Incredible Robo-Plunger comes to life from the machine and defeats the Turbo Toilet 2000. The duo gets their principal out of the TT 2000 and he asks what happened to the school and the teachers since everything is seemingly destroyed. Harold realizes that Captain Underpants must have gotten hit by the toilet water in the Turbo Toilet 2000 which caused him to become Mr. Krupp again. After George and Harold give his clothes and toupee back so he can dress, Mr. Krupp believes he is ruined as he will be held responsible for the mess and lose his job for that. George says they can repair the school, but they want him to cancel their detention and suspension as well as make them principals of the day. Mr. Krupp agrees to this, but only if they can do all that. After giving the Robo-Plunger the necessary commands, he repairs all the damage and takes all the evidence to Uranus with the command never to return. The teachers all believe the events regarding the attacking toilets were just a dream. In return for fixing the school, George and Harold's detention and suspension are canceled and they get to be principals for the day.
As the principals, they hold an all-day carnival for all the students and put the teachers (and Melvin Sneedly for his tattling) in detention. After telling Mr. Krupp that they sold most of the school's furniture to pay for the carnival, Krupp gets angry and they run away for their lives. But Ms. Anthrope snaps her fingers at the boys to come back, but Krupp comes into his trance causing George and Harold to run after Krupp who is Captain Underpants again! They missed him and saw him out the window fleeing from the school into the city as he sings out his battle cry.