This is how Death of Optimus Prime and Twilight Sparkle goes in My Little Pony Transformers: Generation 1: The Movie.
[Rainbow Dash runs toward Ironhide]
Perceptor: I fear the wounds are fatal.
[Everyone looks down sadly]
Spike: Prime. You and Twilight cannot die.
Optimus Prime: Do not grieve. Soon... I will be one with the Matrix.
Twilight Sparkle: Yeah. I'll be the one to teach you about friendship and what it can do.
Hot Rod: Prime...
Optimus Prime: Ultra Magnus... It is to you, old friend, that I shall pass the Matrix of Leadership... as it was passed to me.
Twilight Sparkle: We know that you have the skills of a leader.
Ultra Magnus: But Prime... I'm... I'm just a soldier. I'm not worthy.
Optimus Prime: Nor was I. But one day... an Autobot shall rise from our ranks... and use the power of the Matrix... to light... our darkest hour.
Twilight Sparkle: And guide you and the Autobots down the path of friendship.
[Optimus opens his chest compartment to reveal the Matrix and Twilight uses her magic to levitate it]
Optimus Prime: Until the day...til all are one.
Twilight Sparkle: And all friendships are bonded.
[Optimus and Twilight try to give the Matrix to Ultra Magnus, but it falls until Hot Rod catches it. Hot Rod gives the Matrix to Ultra Magnus and he puts it in his chest]
[The monitor shows Optimus and Twilight's spark and heart beat then they go in a straight line. Hot Rod, Arcee, Rainbow Dash, and Kup see the straight lines on the monitor. Optimus' optics become dull and lifeless while Twilight closes her eyes and dies]
[Optimus and Twilight turn black and move their heads to one side]