Why do soldiers of the gunpowder (when guns were being used more often in europe to the end of Nepoleonic style armies) join?

Obviously there is a good chance you'll die once the whole front line of an opposing army opens fire, its loke litteraly a wall of lead.