The ex-boyfriend of a Universal Studios employee in Hollywood shot and killed himself inside the theme park Friday afternoon, authorities said.

A waitress at Mel’s Diner in the park called security at 2:00 p.m. after seeing her former boyfriend and father of her child around the park, Los Angeles County Sheriff’s Lt. Eddie Hernandez said.

Park security officers notified the Sheriff’s Department and a deputy spotted the man in a secluded smoking area near the “Despicable Me Minion Mayhem” ride, Hernandez said.

When the deputy asked him to stand up, he pulled a gun and shot himself despite the deputy's effort to talk him out of hurting himself, Hernandez said.

The man had two restraining orders barring him from contacting the woman after two incidents at the park, including one about a week ago when the man vandalized the woman’s car, Hernandez said.

Authorities said park security search the belongings of guests, but rarely use metal detector wands, which was how the man was able to get the gun in the park.

The park remained open and was cooperating with the shooting investigation, according to a statement.

"We are working closely with law enforcement and corporate security on this ongoing investigation,'' the statement says. "The safety and security of our guests is always of the utmost importance.''

Universal Studios Hollywood prohibits guns from the park among other items, according to its website.

The Associated Press contributed to this report

Click for more from MyFoxLA.com

Click for more from Los Angeles Times