If I get more involved in space-related games and things, I may move discussions such as this from Sci-Fi Fridays to Interstellar Warfare Wednesdays
I can say "better" because a spacegun does exist; the Russian TP-82. Problem is, the TP-82 is designed for astronauts, but it's meant as a survival tool for earth use.
Arguments about the invincibility of potential aliens we may meet (throwing rocks vs. nuke-it-from-orbit) aside, the possibility of combat in space and orbit remains worth contemplating. There are all manner of Earth organisms that can withstand the vacuum of space, although they tend to be small and occasionally infectious. Still, with present advancements towards compression spacesuits, it's conceivable that some manner of weird alien whatever could evolve a carapace or semi-rigid hide capable of supporting a spore-style trip through the void. And, when humanity reaches the stars proper, I see no reason we'll stop having issues with one another just because space.
Whatever the target, let's assume actual combat. For the purposes of this exercise, we'll be considering something built at present tech level, where substantial space travel is on the verge of becoming a thing. This spacegun will also be assumed to be useful for other environments than 0g and 1g.
First off, good old slugthrowers work just fine in space. Ammo is self contained, and recoil is marginal, although I suspect that under actual combat shooting, repeated shots would add up.
First question is what to use? Space is a very cramped, close quarters environment these days. I see no chance of this changing anytime soon. This, combined with weight and space restrictions, lends itself to very compact guns such as SMGs. However, because space is full of things going very quickly, spacesuits are rather well armored. For this reason, we'll be considering specialty ammunition SMGs, PDWs, and short barrel carbines of various flavors. Namely, the AKS-74U, CBJ-MS, and the MP7 and/or P90. Certain bullpup rifles may be considered if a longer barrel is desired, but the additional weight and complexity of even the best ambidextrous designs remains a substantial negative.
All of these weapons chamber calibers capable of penetrating modern body armor despite the small size. Of the three, the AKS-74 has the greatest energy, but the largest ammunition. The CBJ-MS is essentially a 9mm SMG with a specialty conversion barrel (thus, a conversion of any 9mm SMG is possible), utilizing 4.6mm tungsten penetrators in a 6.5mm sabot. The MP7 and P90 both use proprietary rounds developed on the Small Caliber High Velocity principle to improve armor penetration.
Any gun selected is going to need some modifications for space use. First, the weapon will be nearly incapable of venting heat, lacking an atmosphere to transfer to. Heat sinks and heavier barrels will increase the heat tolerance of the gun. Vacuum plays hell with a great many liquids and similar, which will likely pose problems for the lubricants permitting easy operation of the firearm. A dry lubricant treatment would be a good idea, combined with specialty space-lubes if available. Finally, while recoil from these cartridges is minimal, it's still there. A high efficiency muzzle brake and possibly buffer modified for overtravel to soak up recoil impulse such as that of an AA-12 would also be wise to minimize fuel required to stabilize a combatant firing unsupported in freefall. Oversized grips, possible foregrips, enlarged triggers and trigger guards, and assorted CQB optics and accessories are also recommended because of the difficulties associated with spacegloves.
Skeletonized folding stocks would be standard, but due to the complexities of 0g movement, would likely be utilized only for combat in gravity environments or where a combination of tethers or gravity/magnet boots allowed a stable firing position to be used.
Any weapon going to space is going to warrant specialty ammunition. Everything in space is reinforced to stop very fast moving things from going though it, because space is full of them. The best material we know of for putting holes in puncture-resistant objects is Depleted Uranium. With an easily contained type of radiation, and a long half life, depleted uranium's tendency to sharpen its way through an object when it collides with it at high speed gives it fantastic armor piercing capability. Any round used should be tailored to the gun design being used for maximum performance (faster burning powder, non-standard specifications on casings, etc), in recognition that for the foreseeable future, both weapons and ammunition are going to be specialty items.
Magazines are to be as compact and high capacity as possible with the highest ammunition stack efficiency achievable. Most likely this will be standard high-capacity magazines (40 round double stack boxes, for example) or quad stack mags if they offer suitable reliability and are compatible with the gun. Drums tend to be heavy, complicated, and take up a very large volume for the ammunition capacity they have.
HOW TO CARRY IT
The spacegun's utility is about similar to that of a concealed carry weapon except in the cases of specialized space combat forces. Special forces will likely have their weapons carried in hand, and a fairly standard gear rig comparable to those used on Earth, if a bit more durable with extra care taken to gear retention. However, other weapon-carrying forces such as exploration security forces will be primarily focused on the use of scientific and support instruments, meaning their weapon will spend the majority of its life being carried.
All weapons, indeed all gear in general that goes into space, gets tethered to the carrier. This would also include magazines. For convenient, not-often-needed carry, drop leg rigs with firearm on the strong side and spare magazines on the off-side would keep things handy but out of the way, leaving the valuable torso space to be used for tools and mission specific gear.