It’s like “Charlie and the Chocolate Factory,” but hopefully safer for bratty children.

The man who created Jelly Belly jelly beans is offering to give away thousands of dollars and one of his candy factories through a series of “treasure hunts.”

The catch is that, unlike Willy Wonka’s contest, it costs more than the price of a chocolate bar to join David Klein’s competition.

Actor Gene Wilder as Willy Wonka on the set of the film 'Willy Wonka & the Chocolate Factory', based on the novel by Roald Dahl, 1971.  (Photo by Silver Screen Collection/Getty Images)

Actor Gene Wilder as Willy Wonka from 1971's "Willy Wonka & the Chocolate Factory." (Getty Images) (Getty Images)

BEN & JERRY’S TO RELEASE PODCAST ON THE HISTORY OF ‘RACISM IN AMERICA’

Klein announced this week that he and his partner have been hiding “gold-style tickets in the form of necklaces” in places throughout the United States so he can hold treasure hunts in each state. Tickets to join the hunt – and to receive crucial hints – cost $49.99 per state.

While the golden ticket won’t be packaged inside a candy wrapper, everyone who enters will receive a pack of CBD-infused jelly beans from Klein’s Spectrum Confections.

While the golden ticket won’t be packaged inside a candy wrapper, everyone who enters will receive a pack of CBD-infused jelly beans from Klein’s Spectrum Confections. (iStock)

While the golden ticket won’t be packaged inside a candy wrapper, everyone who enters will receive a pack of CBD-infused jelly beans from Klein’s Spectrum Confections. (iStock)

CLICK HERE TO GET THE FOX NEWS APP

Each necklace Klein has hidden includes a secret code needed to redeem the $5,000 prize.

“With the gold ticket treasure hunt, our goal is to get people out and about with their families,” Klein said in a written statement. “Grandma and grandpa can even join with the kids and grandkids.”

David Klein is the creator of Jelly Belly jelly beans. (Tricky Treasures)

David Klein is the creator of Jelly Belly jelly beans. (Tricky Treasures)

CLICK HERE TO SIGN UP FOR OUR LIFESTYLE NEWSLETTER

Each hunt is limited to 1,000 participants, according to Klein.

Everyone who participates in the statewide hunts will be able to join another hunt for “the ultimate treasure,” according to Klein. He’s getting ready to retire, and the prize will be the key to one of Klein’s candy factories, plus an expenses-paid trip to candy-making school.

Anyone interested in participating can find more information on thegoldticket.com or the gold ticket Facebook group.

FOLLOW US ON FACEBOOK FOR MORE FOX LIFESTYLE NEWS