Very true. Confidence is a huge factor in all sports.
I think confidence is important but overrated. If you are a smart, team-oriented player, you can find ways to be valuable with your playing time even when you are in a slump.
Baseball: When the hits aren't coming, lay down a bunt, focus on situational hitting, hit behind the runner on second, drive one to the outfield with a man on third and less than two out, etc.
Basketball: When the shot isn't falling, hustle on defense, keep yourself in good position, if you are in the right spot and generate some turnovers, that can lead to easy, confidence building layups/dunks on the fast break. On offense, make sure to move well off the ball, set your screens, make your passes. If you contribute to good ball movement, this keep lead to some easy, open shots which can help get the confidence back.
Football: When the ball isn't coming your way, make sure you hustle and hit your blocks, move your feet on routes that aren't designed for you. If your efforts open up the other guys, their productivity will attract more attention leaving you more open.
Hockey: When you don't seem to be scoring, drive the net, create some traffic, set screens. That will generate goals for your linemates, and eventually your effort will be rewarded when a rebound lands on your stick. Also, hustling hard on the back-check can give you a chance to disrupt the other team in transition and generate odd-man rushes the other way, which should create some good scoring chances to help boost the confidence.
I'll stop with the big North American sports. But my point is, even when a player is having a rough statistical stretch, so long as they keep these two maxims in mind: 1) I should be giving maximum effort every second I am out there, and 2) the team winning is more important than me scoring, then they should be able to do some less-recognized but still valuable things to help the team win, and doing those things will probably result in more opportunities for them to find their way back onto the scoresheet.