This is how Optimus lets Thomas and his friends stay and Midnight Sparkle (Bad Clone)'s death goes in Thomas' Adventures of Transformers Prime Beast Hunters: Predacons Rising.
Optimus Prime: Thomas, as an award for helping us stop Unicron, you and your friends and the ponies will stay here on Cybertron as your home.
Thomas: Thank you, Optimus.
Optimus Prime: You are welcome.
Pinkie Pie: We're gonna be the first ponies to live on Cybertron.
Rainbow Dash: Awesome!
Rarity: That is fabulous.
Fluttershy: I for once agree.
Starlight Glimmer: I'd like that.
Princess Celestia: We would be honored.
Princess Luna: I couldn't agree more.
Princess Cadance: Me neither.
Hiro: Awesome! What do you think Baymax?
Baymax: I think I most likely agree.
Optimus Prime: Everyone, there is something Twilight and I must tell you.
Evil Ryan: What is it, Optimus?
Optimus Prime: In order to both protect the Allspark and secure Unicron's defeat, it was necessary for me to empty the vessel's contents.
Thomas: Into where?
Optimus Prime: The Matrix of Leadership and Twilight's horn. As such, my own Spark can no longer be separated from the multitude of others within me. And the very same thing has happened to Twilight. And the reason why I brought Twilight with me was that I wanted to test her and see if she had the capabilities of a Prime.
Twilight Sparkle: That's why Optimus asked me to go.
Princess Celestia: Princess Twilight...
Princess Luna: You're not going to say...
Princess Cadance: You're leaving us?
Ratchet: Are you telling us that you and Twilight are now one with the Allspark?
Smokescreen: That's what you say when someone kicks the.
Ultra Magnus: To not return the Allspark to the well would be to prevent future generations of new life from existing on Cybertron.
Optimus Prime: My quest must be completed with Twilight.
Ryan F-Freeman: Twilight, I didn't help stop Unicron just to lose the pony I care about the most.
Ratchet: Optimus, I didn't return to save a life only to lose the one I care most about.
Thomas: Ratchet's restored planets. He'll find a way to save you and Twilight!
Rainbow Dash: We can turn to Vector Sigma, just like me and Arcee did before.
Optimus Prime: Because the Matrix must now be relinquished with the Allspark, it cannot be restored or passed down to another. But while this may very well mark the end of the age of Primes, leadership can be earned with or without the Matrix, and, in my view.. you have each acted as a Prime.
Knock Out: Well, I never really had the best role models.
Thomas: Twilight... I'm gonna miss you.
Twilight Sparkle: I will too. And all my friends. But I have a few things to say. If evil once again rises in the face of friendship, you can still use it's magic to conquer it. I am also giving the Autobots the chance to use friendship to fight any wrong and turn it into a right and making Thomas the new Element of Magic. It has been an honor being an element bearer, Celestia's student and the Princess of Friendship for such a long time.
[Twilight and her friends have one last hug together]
Twilight Sparkle: Optimus, can I at least say goodbye to my friends before I become one with the Allspark?
Optimus Prime: Of course.
Twilight Sparkle: Girls, I guess this is goodbye.
Applejack: We'll all miss ya, Twi.
Twilight Sparkle: I know, Applejack. And keep being honest.
Rarity: I'll do my best to stay generous.
Twilight Sparkle: Thank you, Rarity. And goodbye.
Rainbow Dash: Be seeing you around.
Twilight Sparkle: Goodbye, Rainbow. And keep being loyal.
Fluttershy: I'll keep up my kindness.
Twilight Sparkle: Goodbye, Fluttershy.
Pinkie Pie: Farewell, Twilight.
Twilight Sparkle: Bye, Pinkie.
Starlight Glimmer: Goodbye, Twilight. I will miss you.
Twilight Sparkle: I'll miss you too, Starlight.
Trixie: Good bye, Twilight.
Twilight Sparkle: Goodbye, Trixie.
Princess Cadance: Twilight. I will miss you, sister-in-law. Farewell. Sunshine, sunshine... ladybugs awake... Clap your hooves...
Twilight Sparkle: And do a little shake.
Princess Celestia: Farewell, Princess Twilight.
Twilight Sparkle: Goodbye Celestia.
Princess Luna: Keep friendship in the underworld alive.
Twilight Sparkle: I will, Luna.
Optimus Prime: As even Megatron has demonstrated on this day, every sentient being possesses the capacity for change. I ask only this of you, fellow Autobots keep fighting the noblest of fights.
Bumblebee: You can count on us to keep the peace.
[Arcee, Ratchet, Bulkhead, Bumblebee, Wheeljack, Knock Out, Smokescreen, Ultra Magnus, Rainbow Dash, Pinkie Pie, Rarity, Applejack, Fluttershy, Starlight Glimmer, Trixie, Princess Celestia, Princess Luna, Princess Cadance, and everyone else watch sadly as Optimus Prime and Twilight Sparkle fly to Primus]
Optimus Prime: Above all do not lament our absence...for in my spark and Twilight's heart I know that this is not the end...but merely a new beginning...simply put another transformation and friendship.
[everyone watches in amazement as Sparks fly out of Primus, including Optimus Prime's Spark and Twilight's heart]
Rainbow Dash: Awesome!
Pinkie Pie: Wow!
Starlight Glimmer: Amazing.
Princess Celestia: Impressive
Princess Luna: Modest.
Princess Cadance: Classy.
Ryan F-Freeman: Megatron will come see Optimus on Earth again. This time, in a new body.
Crash Bandicoot: You're right, Ryan. Who did you and Brutalight create?
Ryan F-Freeman: Brutan Sparkman.
Cody Fairbrother: Who is Brutan Sparkman?
Brutan Sparkman: It is me, Cody.
Crash Bandicoot: Everyone. Let's go home. To Earth.
[Midnight (Bad Clone) grabs Ryan]
Ryan F-Freeman: Hey! What are you doing!?
Midnight Sparkle (Bad Clone): You could help me understand all the magic.
Sci-Ryan: He is learning about magic. [points Sci-Twi's amulet at her] Any last words?
[Ryan tickles Midnight (Bad Clone)]
Midnight Sparkle (Bad Clone): [giggling]
Ryan F-Freeman: You surrender?
[Midnight Sparkle (Bad Clone) laughs and nods]
Sci-Twi: How did you survive? Ryan and Sunset help me defeat you at the Friendship Games.
Midnight Sparkle (Bad Clone): [while still laughing] You... Ha-ha! And your friends... Ha-ha-ha! Can never truly... Ha-ha-ha-ha-ha! Defeat me!
Crash Bandicoot: You're a part of Sci-Twi, Midnight. She can use her form for battling bad guys and you'll be a hero. You'll be back, and THIS time, you will become Sci-Twi's good self, you bring back Twilight and have ALL the magic.
[Sci-Ryan absorbs Midnight (Bad Clone) into the amulet]
Sci-Ryan: There. All better.
Thomas: Twilight will be back, Ryan. I am certain.
Ryan F-Freeman: I thought I was made of sterner stuff, Thomas. Twilight can help you fit in at CHS in Thomas' Human Adventure. [starts crying] TWILIGHT!!!
Starlight Glimmer: Ryan? Are you crying?
Ryan F-Freeman: [sniffs] I'm fine! I thought Twilight and I were the same. But, she became one with the Allspark and it TORE OUR FRIENDSHIP APART!
Starlight Glimmer: Don't say that. If you keep this up, you'll end up like I did.
Crash Bandicoot: What is Ryan doing, Starlight?
Starlight Glimmer: Crying.
Ryan F-Freeman: I have to go back in time and stop Prime from filling Twilight's horn with the Allspark so there will be NO WAY for Unicron to change it!
[Optimus's Spark and Twilight's heart fly to Ryan]
Ryan F-Freeman: Huh?
Twilight Sparkle: (voice) Ryan. Listen to me. If one friendship dies, the result could be disastrous.
Ryan F-Freeman: Twilight? Optimus? How can I hear you?
Crash Bandicoot: How is this possible?
Twilight Sparkle: (voice) Because even if you can't see me, I can always continue to guide you down the path of friendship.
Ryan F-Freeman: So. You're still my friend? Including Optimus?
Twilight Sparkle: (voice) Yes.
Ryan F-Freeman: Wow. How would I become a Prime like Optimus and the other Primes before him?
Twilight Sparkle: (voice) Not sure. But you'll figure it out eventually.
Crash Bandicoot: Optimus? How come Ryan can hear her voice?
Optimus Prime: (voice) Because, Crash, when one Transformer merges with Primus, they can still help those who need them most.
Ryan F-Freeman: What am I doing? How did I doing the same thing like Starlight?
Starlight Glimmer: Because you said this tore your and Twilight's friendship apart.
Matau T. Monkey: If you do what Starlight did in the past, I have to show you what will happen.[uses his magic to make a window of what will happen if Ryan is doing what Starlight did]
Ryan F-Freeman: Is that... ME?!
[Crash nods and Starlight comes to Ryan]
Ryan F-Freeman: Why am I look like that?
Starlight Glimmer: Because if you keep on doing what I did, everything will result in you being the leader of Our Town and make everyone the same and after being defeated once, going back in time and changing the past.
Ryan F-Freeman: What will my name be if I do that?
Starlight Glimmer: Ryalight Glimmer.
Ryan F-Freeman: Ryalight Glimmer?!
Ryan F-Freeman: So if Ryalight is my dark side, who defeat me?
[Ryalight confronts a hero named Codylight Sparkle]
Ryan F-Freeman: Is that... Cody? What happen to him?
Cody Fairbrother: I think it's when if you do what Starlight did in the past, I adapt my name to Twilight's into Codylight Sparkle.
[Ryan tears up and starts crying]
Ryan F-Freeman: I'll just have to keep on being with Twilight. No. I have to move on so I won't suffer the same fate like Starlight.
Crash Bandicoot: What about Twilight? Will she get revived by someome?
Ryan F-Freeman: Don't know, Crash. There must be some way to revive Twilight and Optimus in thier bodies. [uses his magic to make the window disappear]
Matau T. Monkey: Look, Master Ryan. It's not that rough. We could go back to Earth and maybe Twilight will come back.
Ryan F-Freeman: I guess you're right, Matau. Why could it been me instead of Twilight? Optimus is a Prime and Twilight and I are not.
Crash Bandicoot: Be right back. [dives into Cybertron's core and comes out with the Crystal Mirror] How did this mirror get here?
Ryan F-Freeman: Remember this, Twilight?
Twilight Sparkle: [voice] Yes, Ryan. It's the same mirror I used to go to Canterlot High.
Crash Bandicoot: But it will open once every 30 Cybertronian moons. My friends and I shall use this portal to go to Earth and wait for your return to life.
Applejack: Yer leaving us?
Sci-Ryan: Yes. Until we meet again.... Till all are one. [goes into the portal]
[as Ryan's friends go to the portal, Ryan stands by Twilight's heart and Optimus' spark]
Ryan F-Freeman: [narrating] With Unicron gone, he won't try to destroy Cybertron ever again. Thanks to some friends and new ones, we were able to defeat Primus's brother and banish him to another world. I am Ryan F-Freeman, student of Princess Celestia, Primus and Optimus Prime, and I send this message in memory of Optimus Prime and Twilight Sparkle, my friend, and to every villain and Con who try to stop us. What ever plan you make or threat you might offer, know that it will not last. Cybertron and Earth are both our home. Plus as long as we stand together, the Autobots will protect all worlds.