(CNN) -- It was a mad dash to hug Hillary Clinton.
Toward the end of an event Friday at the Bronx Children's Museum, Supreme Court Justice Sonia Sotomayor set dozens of kids upon the former secretary of state, urging them to hug her and other leaders who attended.
But first, Sotomayor got the children fired up.
"I need for you to do something right now," she said, holding a microphone and standing among a hoard of kids wearing bright green t-shirts. "I need for you to jump up and down and say thank you for caring for me!"
"On the count of three," she continued.
But it was too late. The kids, eager to take any chance to jump, had already stood up and started enthusiastically bouncing off the ground, some with their hands waving wildly in the air.
After a few seconds - some of them still hopping - Sotomayor gave them another task.
"I'm going to scare all of these important people," she said, pointing to Clinton and a few adults who were sitting just feet away on the front row of the auditorium. "I want a bunch of you to go to each of them and hug them and say thank you."
Unsure if it was really OK, the kids hesitated for a second, then quickly swarmed together and bee-lined for the former first lady.
After about 20 seconds of what had clearly become overwhelming excitement, Sotomayor injected. "Alright, don't go crazy."
"Alright, you've got to be careful," she added, this time her voice a little louder.
Suddenly the Supreme Court justice found herself dealing with crowd control.
"C'mon back. C'mon back. C'mon back guys. Come sit," she said.
Smiling the whole time, Clinton tried to hug, pat heads, or pat the backs of the mass of children inching towards her.
Sotomayor continued to give more instructions to "come sit down", "face the screen," and "shhhh." Other adults stepped in to help get the children seated.
And about two minutes after the excitement started, Clinton and the kids were sitting back down, and Sotomayor's court was no longer out of order.