Here's how the ending goes in The Last Trainbot Knight.

Kraken: It's over at long last, he's really gone.

Twilight: (as Sarah Connor) It's over.

Spike: Guys look.

[We see a aura of magic going back into Solar Flare's horn making him stand back up]

Princess Celestia: Father, you have your magic back!

King Solar Flare: Yes. And my own strength. Thank you guys, for saving my life.

Princess Celestia: It was no problem, father.

Brian: Well, I'm just glad we won't have to deal with Tirek anymore.

Cera: Same here, Brian. Same here.

Princess Luna: But we do not have true victory yet, Tirek may be destroyed now, but Raygar is still out there somewhere. And his mysterious Sith partner.

Edd: Where's Thorn Flower and Joshian? 

Tempest Shadow: (hangs her head low) They're dead. They died in the explosion that destroyed the Storm King. 

King Solar Flare: (sighs) Their sacrifices will long be remembered to this day, we shall make a memorial for those brave individuals who help us destroy the Deceptitrains at long last.

Peter: But on the bright side, we're all free from the Centaur's rein.

[As that happens, Thomas turns to the other Trainbots]

Thomas: So, you guys think you might stay a little longer?

Trax: I don't think so, OpThomas. Since our planet has finally returned after the war. We shall rebuild it, and your's. But to be honest, I think it's time for us to go home.

[Soon, the Insect Boys transform back into their bug modes, and the Trainbots use Shutdown's ship. And they fly up to Cybertrain, as it begins to move out of Earth]

Optimus: [narrating] Today, we were at our finest hour. Thomas, Princess Celestia's student, and my apprentice had turned on us. But was managed to turn back to our side, and we have sucessfully managed to kill Megatrain for good, and destroying the mad goddess "Angel Death". And most importantly Tirek has finally been destroyed, and defeated for good

Ember: [lefts up Gabby] I'm proud of you. [strokes her mane] You did good, sweetie. Real good.

Gabby: [giggles]

Optimus: [continues narrating] And even though Jessica Shrew and T1-96 had escape the battle, the Storm King is finally gone for good too. And now, the secret of the Trainsformers has finally been revealed, and we must help them restore their world. As well as our's. I am Optimus Prime, and I send this message to other Trainbots, that it's time for you, to come home.

[And then the film ends with "Rainbow" by Sia]

[But then a mid credit scene plays as we see the scientists' inspecting one of Unicrane's horn till they hear a voice]

Voice: Humans! [the scientist stop who they're doing] I want you all to stop what you are doing!

[The scientist look around and ask each other what made that sound]

Voice: Don't be afraid. But don't go near or touch me if I were you. I don't like it.

Scientist 1: Who doesn't like what?

Scientist 2: Who are you?

Voice: Unicrane! If you all can join me, we can get rid of the Trainsformers threat.

[Then down in the Earth's core, we see 2 red eyes opening up and glowing as we hear dramatic music playing in the background and it cuts to black]

[Then the rest of the film credits plays with "Bring Me to Life" playing in the background]