Principal Skinner tells Groundskeeper Willie that he plans to retire, with Martin discovering the secret and blabbing it to the entire school. During the final sendoff, Skinner chooses Bart Simpson for his final farewell, who attempted to shoot him in the head with a rock. However, it was revealed that the retirement was just a ruse so Skinner would finally blow the whistle on Bart after years of being pranked by him.
Feeling embarrassed and angry, Bart chooses to pull off the ultimate prank to the entire staff by super-gluing the faces of Skinner and staff with plastic Krusty the Clown masks. Unfortunately, this causes people around Springfield to become terrified of clowns, and also causes Krusty to lose his comedic edge.
Because of this, Krusty is no longer a comedic character and even loses his clown appearance and make-up. Homer Simpson then says that Krusty looks just like him. Lisa then convinces Krusty to turn into a serious actor, and he takes part in a parody play version of Death of a Salesman, called The Salesman's Bad Day, written by Llewellyn Sinclair (his second appearance from "A Streetcar Named Marge") who at first couldn't do, until Sinclair motivates him, causing Krusty to become a serious actor until his clown self appears in his mind, telling him that he is still a clown and nothing else.
Meanwhile, Bart is in court and was about to be free with the "boys will be boys" saying, until Marge Simpson objects and tells Judge Dowd that what Bart did was terrible and he has a real problem with pranking and suggests that Judge Dowd punishes Bart, resulting in him going to a rehab center for almost a month. Although Marge thinks she did a good thing, she doesn't know if it really was a good thing herself. During a session as Bart places tacks on the doctor's chair, the doctor convinces Marge to come in and sit on his chair, causing Bart to stop the prank and completing one step of his treatment.
After being released, Bart goes to apologize to the people whom he pranked. However, with the encouragement of Willie, Bart plans to pull the ultimate prank, staging a fake apology announcement at the gymnasium where above the crowd is a net full of water balloons. But when he sees Marge in the crowd, he tries to tell people to run away but the weight of the water balloons breaks the net, causing the crowd to get splashed with the water, with Marge finally realizing "that boys will be boys" saying is real and that motherhood stinks, followed by Homer saying the same saying and Marge walking into the boys restroom to get even with him.
On the night of the play, Krusty is still being haunted by his former clown self. During the play, as Krusty tried to quiet the voice inside his mind, he causes the audience to laugh. He realizes that he is not a serious actor, but a clown, and starts to do comedic antics.
In the final scene, the play that Krusty was in is later seen being witnessed by the ghosts of Krusty, Arthur Miller, Rabbi Hyman Krustofsky, and William Shakespeare.