Age 8. Before they could go to the range, they had to memorize and recite the Four Rules, and they had to write them out. Lots of praise when they got it right.
At the range, my goal was to make it a positive experience. I have seen morons try to "scare" their children into "respecting" guns, by handing them a .357 Magnum and no ear protection, or by shooting something and blowing it up, to dramatize how powerful and dangerous guns are. IMO, all they did was teach their children to hate and fear guns (and their moron parents, who would abuse their children that way).
They got eye protection and ear protection. I used targets with huge 10-rings, and put them at 5 yards. Then, with no time pressure, the kids got to shoot at the targets, off a bench. Not surprisingly, they got 5 bullseyes. I praised them for their spectacular marksmanship. They got to save their targets, and put them up on display in their bedrooms.
Same drill as they progressed through more powerful or more complex weapons (like handguns). I always set up the first experience so they could not fail. They were both shooting .45 autopistols by age 12. They did not shoot at humanoid (e.g. IPSC) targets until age 13, after we had a discussion about there being very few, but some, really bad people in the world, and how, sadly, sometimes it was necessary to shoot another person to stop their evil.
No scolding, all smiles, all positive reinforcement.