Thanks to series likeGame of ThronesandThe Walking Deadthat have madekilling off main charactersa normal part of series’ story development, it’s not uncommon for surprise deaths to occur on the small screen. But sometimes character deaths aren’t planned, but rather have come as the result of an actor dying in real life.

Following therecent deathofRiverdaleactor Luke Perry, it has been confirmed thathis character on the CW’s popular teen drama will also meet his demise. Over the years, plenty of actors have died unexpectedly, leaving series’ creators little choice but to announce the death of their characters as well. The manner of scripted death varies, but the hope is to respect and honor the actors who poured their heart into bringing these characters to life.

Debbie Wolowitz –Big Bang Theory

While Mrs. Wolowitz was never actually seen on camera, her loud and shrill voice permeated many an episode as she yelled at her mama’s boy son, Howard (Simon Helberg), to rub her feet, or just reminded him of her importance in his life. When the actor who voiced Debbie, Carol Ann Susi, passed away, Mrs. Wolowitz met her end too, dying in her sleep. An entire episode was dedicated to the character’s death, serving as a tribute both to the character and the actress who was part of the cast since the beginning.

John Ritter –8 Simple Rules for Dating My Teenage Daughter

It was a shock when Ritterdied suddenlywhile filming this sitcom about a father trying to navigate life with teenage daughters. Naturally, his death impacted the very premise of the show, not to mention that Ritter, a tremendous on-screen talent, would be impossible to replace. The series went on hiatus, then returned without Ritter, whose character was written off, and with a new name,8 Simple Rules. James Garner and David Spade joined the cast as the girls’ grandfather and cousin respectively, but the series just couldn’t continue without Ritter, and it was canceled after its third season.

Mister Hooper –Sesame Street

It would have been the safe route to suggest that the elderly Mister Hooper, who had run Hooper’s Store on the long-running children’s show since the 1970s, had retired. Instead, the series decided to use the passing of the actor, Will Lee, to teach children about death. Theepisode won a Peabody Award, confirming that the bold decision paid off.

Livia Soprano –The Sopranos

How do you handle the death of a mobster’s mother? In the case of Livia, when actor Nancy Marchand passed away in real life, the character was killed off on the show. It was clear her performance could never be replaced — Livia wasranked as the third-greatest TV villain of all timeby Rolling Stone, and the character reportedly was set for a major story arc in the upcoming season. Interestingly, they brought her back for one last scene bydigitally superimposing Marchand’s headonto another actor’s body, and using outtakes and dialogue from earlier episodes.

Peter Gregory –Silicon Valley

One of the most compelling characters on the series, it was terrible news when actor Christopher Evan Welch, who played the awkward and eccentric billionaire tech investor — a characterloosely based on PayPal and Facebook titan Peter Thiel— discovered that he was on borrowed time just prior to shooting the series’ pilot episode. He only appeared in five episodes before he died, after which the show had to be rewritten to remove the character. On the series, the characterdied under strange circumstanceswhile away on safari.

Edna Krabappel –The Simpsons

It might seem like a voice actor is easy to replace, but in the case of established characters like Edna Krabappel, who had such a memorable and distinct voice provided by Marcia Wallace, the series thought it best to simply retire the character after Wallace’s passing. The character’s death was briefly referenced in an episode, but was more notably honored in a brief yet touching section of theepisode’s opening sequence.

Finn Hudson –GLEE

Cory Monteith sadly dies at a young age, creating a tough scenario for a cheery series about a group of oddball kids in a high-school glee club. Rather than recast another actor to play the strapping young jock with a heart of gold, the series dealt with Monteith’s death head-on, deciding that Finn himself would die, and the teenage characters (and actors) could grieve on screen in kind.

“Coach” –Cheers

When you thinkCheers, you probably visualize Woody (Woody Harrelson) and Sam tending bar. But Harrelson actually joined the cast in the fourth season, following the death of the original bartender, Ernie “Coach” Pantusso, who was played by Nicholas Colasanto. Viewers were told that Coach passed away, but we didn’t get much information about the circumstances. Instead, the announcement of his death was used as a way to introduce Woody as Coach’s former pen pal.

Bill McNeal –NewsRadio

The world was in shock when revered comedic talent Phil Hartman was tragically killed. At the time, he was appearing on this sitcom as a news co-anchor for the fictional WNYX news radio station. In the series, it was said that McNeal died of a heart attack. As the cast returns from attending his funeral, they cleverly interject some comedy into the conversation to make light of the heavy subject, joking about a flower arrangement that was ironically shaped like a broken heart. Jon Lovitz, anotherSaturday Night Livealum, played the role of McNeal’s successor.

Owen Granger –NCIS: Los Angeles

Revered actor Miguel Ferrer, known for his roles in movies likeRobocopand series likeTwin Peaks,died in 2017. After the character was stabbed and taken to a hospital, the series dealt with Ferrrer’s death by having Granger seemingly disappear, leaving a note saying he had “unfinished business to take care of.” The episode ended with atouching tribute to the actor.