RE: Why did my fish die in 3 hours? (Fish bought from walmart)
I would not rule out ammonia that quickly. I have a 100 gallon tank and I keep *4* goldfish in it. Goldfish produce a lot of waste and if you are putting them straight in a new tank there is zero beneficial bacteria in there to process ammonia waste into harmless nitrates. If your tank is anything under 50 gallons, 20 goldfish could indeed poison themselves with their own waste in a few hours.
In any case, the problem is almost certainly in the water one way or another. Either ammonia or improperly prepared water in some way. Consider the possibilities: chlorine, stagnant, extreme temperature, contaminated (e.g. soap, insecticide), etc etc.
Start. Tanks. Slow. Test the water. Then either do a fish-less cycle or add one small fish that is hardy, like a guppy. And don't put 20 messy goldfish in anything smaller than a child's paddling pool. They produce a lot of waste.