Stardate 2713.5: The Enterprise picks up a signal from a planet and as they approach, it becomes clear it is a near-exact replica of Earth. Kirk takes a landing party down in the vicinity of the distress signal and finds deserted long-abandoned streets. A raving teenager attacks McCoy and they subdue him. He cries piteously before having a seizure and dying. They hear a noise and run to investigate a nearby building where they find a teenaged girl. She identifies herself as Miri and refers to them as "Grups." She doesn't understand the game they're playing, and warns them the Grups yell and scream and attack them.
Spock takes the two security guards and look for the nearby children, who taunt them from cover and stay hidden while throwing junk at them. They report back to Kirk, and Kirk tries to get Miri to take them to a medical center. However, Miri notices that Kirk is already displaying the blue blotches that signify infection.
The landing party goes to the medical center which also houses the transmitter of the distress signal. Spock appears immune and they discover that the planet's scientists were working on a long-prolongation experiment. They beam down medical equipment from the Enterprise and start relaying the medical files to the ship's equipment. Spock and the others note that Miri has a crush on Kirk which is why she's staying with them.
They relay information back to the Enterprise and determine that the children age at a very slow rate. Miri and Kirk go exploring and they find the children, including one of them who has reached puberty and is covered with the blotches. She attacks Kirk while the other children flee, and the captain is forced to stun her, but she dies of the shock.
Back with the others Spock goes over one of the scientist's journals, and determines they only have seven days, and Miri may have five or six weeks. Although Spock is immune he is still a carrier and trapped on the planet.
After two days, McCoy finds a key series of papers that show the scientists were going to create a chain series of viruses. He and Spock start recreating the scientists' work when they hear the children outside. When they go to investigate, the children's leader Jahn sneaks in and steals their communicators. Kirk and the others return and realize they have no chance without the communicators. Further, they determine the food is running out for the children, and their tempers are running short as a disease symptom. Yeoman Rand panics and runs outside and Kirk goes out to comfort her. Miri, seeing this from hiding, is intensely jealous.
McCoy breaks up the moment to reveal that he has found the disease and now it's a race to pin it down. Miri goes to the other children and comes up with a plan to lure Rand away by saying one of the children is hurt, then they'll have Kirk when he goes to find her.
Rand goes missing and Kirk demands answers from Miri, who feigns ignorance. McCoy and Spock have created a vaccine but they have no way to confirm it without the ship's computers. Jim tries to explain to Miri the children will eventually die if they can't find a cure. He shows her that she has the blotches as well.
The children are playing another "foolie" with Janice tied up, when Miri brings Kirk in. He tries to explain how they're all in danger but Jahn and the others shout him down then close in on him and start beating on him. Kirk staggers free and points out that Jahn will be next as the oldest, then shows them they're hurting just like the Grups they're afraid of.
Back at the medical center, Spock goes to check on Kirk and McCoy decides to inject himself with the experimental vaccine, then collapses in agony. Spock tries to revive him without success. Kirk arrives with the children… and the communicators. McCoy's blemishes fade.
Later the Enterprise leaves orbit after leaving a medical team with the children. Rand notes that Miri loved Kirk and he jokes about never getting involved with older women.