The fairy tale "The Pied Piper" written by the Brothers Grimm
It is said that in the Middle Ages, Hameln was plagued by rats. At that time, there was an industry specializing in catching rats, and most of the rat catchers were wandering entertainers who could play musical instruments. In 1284, the town of Hameln was infested with rats, which annoyed the residents and left the mayor helpless. One day, a mysterious flute player wearing colorful robes came to the town. He said that if he could be paid a reward, he could help the people in the town get rid of rats. People readily agreed. So he took out his flute and played it. Attracted by the magic of the flute, the mice ran from the house to the street and followed him to the Weser River. As a result, all the mice drowned in the river. Afterwards, he returned to the town to collect his reward, but the residents of the town broke their promise and refused to pay. The flute player was furious and determined to take revenge. He played the flute again, and this time the sound attracted 130 children from the town. The children ran out into the street and followed the flute player out of the city gates and disappeared into the forest.
This is a cartoon adapted from a fairy tale. I have watched one, but I don’t know if it is what you watched.