Mermaid Man and Barnacle Boy show the locker to SpongeBob and Patrick because they helped push the Invisible Boatmobile up a hill for them. They show them some of the items inside, such as the Dirty Bubble's bubble wand and the time machine. Patrick thinks that the time machine is a vending machine and presses buttons on it until he accidentally sends them all back in time.
Back in time, Patrick eats the young Mermaid Man and Barnacle Boy's tartar sauce that they were about to use to trap Man Ray. Man Ray is now able to take over Bikini Bottom, and SpongeBob and Patrick flee back into the locker and travel to the present.
In the present, Man Ray has taken over Bikini Bottom and established a new city in its place. SpongeBob and Patrick free Mermaid Man and Barnacle Boy and travel back in time to stop time duplicate Patrick from eating the tartar sauce.
When they arrive, they are too late, but all of a sudden, tons of lockers start appearing out of nowhere. Some contain SpongeBob and Patrick trying to stop Man Ray, and others contain lots of time duplicate SpongeBobs and Patricks. This confuses Man Ray so much that he is captured by the young Mermaid Man and Barnacle Boy. The episode then ends with more and more time travelers showing up.