My Nikon D5000's buffer?

I was trying to make a stop motion video, but around every 2 seconds, when using the flash, I'd have to wait around 10 seconds until I could take my next picture. Could this be because of the slow mb/s on my memory card, or perhaps the shutter, or maybe the flash is loading and taking a long time. What is the problem and how can I fix or improve it?

Yo are not waiting for the image to write to your memory card, but for the flash to charge.
If you used a high output electronic flash and set it to 1/64th power, the recycle times should be short enough to keep up with 2 fps shooting rate
Unless your shutter speed is set to 10 seconds, that could not be the problem