After you find Pinocchio in Kingdom Hearts, you'll take him back to the old man (Geppetto). Shortly after, Riku shows up on the scene.
What follows is a brief game of hide-and-seek with the group, which escalates into a confrontation between Riku and Sora. You'll then have to battle Riku.
Hopefully that clears up what comes next in this part of the story!