Ponyville is rumored to be the 4th world in Legacy of the Keyblade.

Allies

Twilight Sparkle (partner)

Spike

Pinkie Pie

Rainbow Dash

Applejack

Rarity

Fluttershy

Princess Celestia

Prince Blueblood

The Cutie Mark Crusaders (Apple Bloom, Sweetie Belle and Scootaloo)

Antagonists

Nightmare Moon (Princess Luna)

Discord (2nd visit)

Pete (2nd visit)

Scratch and Grounder (2nd visit)

Coconuts (1st visit)

Maleficent (1st visit)

Story

1st Visit

Sora, Donald and Goofy arrive at Canterlot gardens still confused about what Queen Minnie said about a girl named "Twilight Sparkle". Goofy suggests they should split up to look for her. Later at the library they meet the girl who turns out to be a young unicorn, who tried to warn Princess Celestia about the return of Nightmare Moon after 1000

Years. Donald meets her baby dragon friend Spike. The five receive a letter from the princess telling her to just make some friends. The trio come along with their new friends to Ponyville. In arrival, Sora sees a short person in a black coat. They think it was the King but turned out to be one of Pete's lackeys Coconuts who went on a top secret mission to find the secrets of the Nobody developers, Organization XIII. He also has a copy of the Kingdom Key D. The three battle the robotic monkey and later that night on the longest day of the thousandth year, Nightmare Moon arises from her prison on Kingdom Hearts, she declares the night will be eternal. The Mane Six and the trio head to Twilight's library to find a book on the Elements of Harmony. Eventually they turned out to be in an abandoned castle in the Everfee Forest. When reaching the castle, Sora and Twilight are transported to another room upon meeting Nightmare and Maleficent, who destroy the elements. Donald, Goofy, Applejack, Rarity, Rainbow Dash, Pinkie Pie and Fluttershy reach that room, it turns out that they were the sources of the elements. Honesty, kindness, laughter, generosity, loyalty, trust, power, sharing and magic. Creating the nine Elements of Harmony and defeating Nightmare, who turns out to be Celestia's younger sister Princess Luna. During the celebration party honoring their heroic victory, Sora seals the gate to Agrabah, the world of their old friend Aladdin. The three say goodbye to their new friends and leave.

2nd Visit

The three return to the kingdom of Equestria from their mission in Agrabah. But to find it in total chaos and their friends missing. Team Kingdom Hearts arrive at a mysterious hedge maze to find the six but Twilight and Rarity's horns disappeared and so did the wings of Rainbow Dash and Fluttershy. The found out that they were taken by the evil being Discord, the Spirit of Chaos. While getting through the maze, the trio and Twilight find out their friends have changed. Applejack was talking to nobody; Rarity gets ahold of a rock mistaken for a diamond, Rainbow Dash returning to her old hometown Cloudsdale, Pinkie Pie not laughing and Fluttershy trying to kill Donald and Goofy.

They all meet at the finish where the maze disintegrates to find Pete and his two henchmen Scratch and Grounder with the same weapons the trio has. After battle, the nine meet Discord again. Back in town, the gang tries to defeat him. But with the help of Twilight, they got their friends back and defeated Discord. Twilight said that Sora will find Riku. The end.

The Mane 6, the Princess and Spike were seen after Xemnas's defeat with a honor ceremony.