system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How Rail Guns Work

I was bored at work and looked up coil guns on wikipedia because I was curious on how they work since the Gauss rifle is my favorite weapon in Fallout: New Vegas. I understood how that worked fine. I had trouble understanding the concept of rail guns, however. I got lost when it started talking about the opposite polarities...
gpt
A railgun has two rails that are parallel to each other.  The rails generate a magnetic field which forces an object to move forward through them.  The ammunition is a metal object which is affected by the magnetic fields.

You know how when you try to put two magnets together, and they resist each other?  It's that same force, except the direction of the force will send the projectile forward.