You fight Ansem multiple times as he tries to summon Kingdom Hearts to fill himself with the power of darkness. In the end, a beam of light shoots out and finishes Ansem. Riku and the King are inside Kingdom Hearts and help Sora close the door of light. Sora sees Kairi one last time in a dramatic moment, and then the credits roll.
Afterward, Sora, Donald, and Goofy are walking along a crossroads when they meet a figure in a black hood who tells Sora he will lose something dear. Sora then heads toward a castle—and the rest of the story continues in Kingdom Hearts: Chain of Memories.