On Geonosis, General Maximilian Veers and his deathtroopers begin building an army of battle droids using components from the recycled droids and B1-series battle droid stocks at the droid foundries. As C-3PO, R2-D2, Chewbacca, Lando Calrissian, and Nien Nunb await an unknown terrible fate, 3PO pleads with General Veers not to remake him as a battle droid. The General is unmoved and suggest that 3PO would like to go next. He then leaves and orders his men to guard the prisoners.
R2 then convinces 3PO to distract the stormtroopers by telling them stories while he uses his fusion welder to melt his chains. C-3PO regales the stormtroopers with the "real story behind the Battle of Endor". C-3PO retells the story of the rebels' plan to free Han Solo from Jabba the Hutt's Palace on Tatooine. In this version, a blind Han accidentally walks into Jabba; awakening the Hutt and his entourage. Luke Skywalker then enters the palace and uses the Force to levitate two of Jabba's Gamorrean guards in an attempt to reason with the crime lord into freeing them. However, Jabba decides to feed them to the sarlacc at the Great Pit of Carkoon.
In 3PO's version of the attempt, the rebels are aided by several characters including Qui-Gon Jinn, Ben Quadinaros, Noga-ta, Lobot, Jar Jar Binks and Watto. R2 still fires new lightsaber but it falls into the sarlacc's mouth. However, the sarlacc spits it out and the ricocheting lightsaber knocks out several of Jabba's henchmen. Luke manages to catch the lightsaber this time and frees his friends. R2 also uses his electric pole to sting Salacious B. Crumb, causing him to fall directly into the sarlacc's mouth. Lando also falls in but is pulled out by Han and an Ithorian.
Luke also falls into Jabba's mouth but Leia and 3PO free the Jedi by performing the Heimlich maneuver on Jabba. Leia then destroys Jabba's sail barge with the ship's cannon before the rebels flee the scene on one of the remaining desert skiffs. Boba Fett manages to clamber out of the sarlacc's mouth only to be knocked back into the pit by a falling Jabba. Once in space, the rebels split up with Luke and R2 going to see Master Yoda while 3PO and the others head back to the rebel fleet.
On Dagobah, Luke learns from Yoda and Obi-Wan Kenobi that Vader is indeed his father and that Leia is his sister. At the rebel meeting, Admiral Ackbar comes up with a plan to destroy DS-2 Death Star II Mobile Battle Station by sending a strike team led by Han to destroy the shield generator on Endor. Luke accompanies the strike mission but is fearful of endangering the mission. During the speeder bike chase, C-3PO rides on R2-D2 who refuels Luke's bike. In the end, Luke, Leia, and the droids end up peddling a bike through the forests. The rebels then fall into an Ewok trap.
Meanwhile at Death Star II, two Lego workers haggle over the colors of the bricks used to construct the superweapon. In the Emperor's Throne Room, Emperor Palpatine and Darth Vader discuss their plan to lure Luke and the rebels into a trap. Meanwhile, Calrissian and the rebel fleet travel to Endor. Back on Endor, the Ewoks had Luke, Leia, Han, and Chewbacca tied up and placed in a cauldron, waiting to be cooked, however they thought that 3PO was a god. Luke convinces the Ewoks to let them go by using the Force to play several magician's tricks on the Ewoks.
Luke then leaves to confront Vader but not before revealing to Leia that they are his children. In space, Jar Jar Binks is seen floating some miles away from the Second Death Star, where Palpatine meets Luke and reveals his plan to trap the rebels. Han Solo's strike team encounters setbacks when a booby–trapped door damages R2 and they surrounded by several AT-ST walkers while the rebel fleet discovers the shield generator is still operational. According to 3PO, the rebels' situation on Endor seemed bleak.
Back in the present, one of the stormtroopers asks C-3PO what happened next. Before the protocol droid can continue, General Veers returns to the cell and orders the stormtroopers to bring the next droid. The stormtroopers remove a broken-down GNK-series power droid and leave the room. R2-D2 then breaks free of his chains but leaves the room, without freeing the others. 3PO is angered by the astromech droid's perceived betrayal and replies with a sarcastic "R2-D2 betrayed everyone he ever knew! The end!" when the stormtroopers return. Lando then volunteers to continue the "real story" behind the Battle of Endor and startles the stormtroopers by claiming that Darth Vader saved the rebellion.
In space, the rebel fleet flees the operational Second Death Star by flying among the Imperial fleet. While angered by the rebels' defeat, Luke refuses to give in to the dark side until the Emperor goads him by telling him that he will never be as cool as Han Solo, proceeding to attack Vader. On the forest moon, the captured rebel strike team are rescued by the Ewok army. R2 and an Ewok also catapult the Imperial commanding officer into the forests. Back on the Second Death Star, Palpatine enjoys watching the duel between Vader and Luke until he is clipped in the nose by Luke. However, Luke refuses to kill Vader once he is disarmed and the Emperor attacks him with Force lightning.
The destruction of the shield generator allows Calrissian to lead an attack on the Second Death Star. He also promises Han not to damage his ship. In the Emperor's Throne Room, Vader saves his son and throws the Emperor into the reactor core. Vader reconciles with Luke in his last moments, briefly having his head taken off when Luke tried to remove his helmet. ("It's a little tricky," he replies) Luke then escapes the Second Death Star with Vader's remains before the superweapon explodes. Ending the story, Calrissian stresses that Vader's sacrifice restored balance to the Force. His story-telling skills impresses the stormtroopers. However, Veers is not impressed and orders his men to take the prisoners to the smelter.
Suddenly, R2-D2 reappears with the Millennium Falcon, which breaks a hole in the wall. R2 uses the ship's cannons to attack Veers and his men. The rebels then flee aboard the Falcon while Veers launches his emergency plan. Using the Lego bricks, General Veers creates a giant B1 battle droid that grabs the Millennium Falcon. Before the Falcon can be destroyed, Admiral Ackbar arrives in his Delta-7B Aethersprite-class light interceptor Daisy Mae and bombards the giant battle droid. The Falcon breaks free and the rebels return to the Forest Moon where they receive another heroes' welcome. During the festivities, C-3PO declines a medal and instead offers it to Chewbacca as a belated compensation for accidentally destroying his medal after the Battle of Yavin.