Article will continue after advertisement

A mother is thanking a stranger for teaching her daughter an important life lesson at a festival.

Brea Schmidt of Cleveland shared the story to her Facebook page, The Thinking Branch, where it quickly went viral.

She explained that she took her daughter to a church festival, where her daughter was trying to win a doll of Poppy from “Trolls.”

“Every time we tried, we lost,” Schmidt wrote on Facebook. “Each time, she sweetly asked for another dollar for another try, until it got to the point where it had been enough.”

RELATED: After ALS diagnosis, educator teaches students an important life lesson 

Finally, Schmidt decided it was time to teach her daughter the important lesson that sometimes you don’t get exactly what you want.

“The one about not winning all of the time. About accepting that there are things that you want, and no matter hard you try, you still might not get them. The one about appreciating all of the dollars from Nana, Papa and Mommy that even let her play in the first place,” wrote Schmidt.

Her daughter was upset, and started to cry. But a stranger saw what happened and stepped in.

“She says, ‘You know what, honey, I have a dollar and I’m going to to give another try for you,'” wrote Schmidt. “The woman grabbed a dollar from her personal wallet, snags the three-for-$1 ticket from the bucket of tickets… and no joke opened a winning ticket.”

Her daughter was thrilled and proudly claimed her new doll and told Schmidt, “Mommy I can’t believe I have Poppy.”

Schmidt said she made sure her daughter walked away learning another important lesson that day.

“So what did you learn about what you should you do the next time you see someone sad?” Schmidt asked her daughter.

“Do something nice for them so they’re not sad anymore,” her daughter responded.

Schmidt said she hopes the lesson comes in handy, since her daughter will be starting kindergarten next month.