Most people do not have vast amounts of ammunition stockpiled
I know of a very certain cartridge that you can find almost anywhere in America, hell, even find on the street occasionally...
A .22 is an absolutely ideal weapon, especially if semi-automatic and with a scope attached. Why? It comes down to the simple rules about guns:
Penetration on a .22 is more than adequate at even beyond 100 yards. It will punch right through the front of the skull but not through the back, making it bounce around inside the head, effectively turning the brain to mash. While absolutely obliterating the head is cool, it might make the more woozy of us gag and vomit. Seeing a head explode is not something normal people get used to.
Availability of .22LR is also very important. .22LR is by and large the most common round in existence, and when you do find it (and you will), chances are you'll find it in absolutely insane volumes. Due to the very cheap nature of the round, the people who own .22s can buy hundreds of rounds without crazy objection to their finances, making them do so with ease. You will very likely never run out of ammunition, and if you do, it's your own fault for not looking hard enough.
Weight is also a key factor. Not just of the rifle, but of the ammo. .22s are small and weigh almost nothing. Compared to that of a 5.56 or a 7.62, they're very light and take up way less space in your pack. The rifles also very often weigh very little, as there doesn't need to be as much steel to keep the pressure in.
Recoil of a .22 is virtually nonexistent. The ability to pop off round after round with almost no divergence from the target is important in the unfortunate event that you miss, and trust me, you will miss. Even the best miss under pressure.
Finally, noise. .22s are very quiet, and even when fired next to your face have very little chance of causing any painful injury. Oftentimes the sonic boom is far louder than the firing itself, especially downrange. The zombies won't know what hit them.
And that children, is why the .22 is a perfect round for killing zombies. People? Not so much. People can return fire.
As for melee weapons, that should be the absolute very last resort, when all the chips are up and you're seriously being considered for tonight's barbecue. Anything can be a melee weapon, but light, blunt objects are your best bet. Baseball bats are perhaps the best at this. That have virtually no chance of getting stuck in the zombie, are very easy to you (no chance of cutting yourself), keep the blood down (so you don't get it into any open cuts you might have), and are easy to find.