Yeef said:
I can play most classes relatively competently, but for some reason I just can't get the hang of Sniper.
It's hard to give advice for sniper even though it is by far my most played class (over 100 hours when most the others have 20 or less), partly because snipers really live and die on the player's aim more than any other class. If you don't have a really strong ability to predict movement and make consistent shots, you'll probably be significantly more useful to your team as another class even if your total points on the board are similar.
One of the main things you have to do is to NOT get into "sniper wars" unless you absolutely have to try and neutralize an enemy sniper who is in a bad position for your team (and you have no good spies to take care of them). This is the fastest way to be totally useless to your team unless the other sniper is clearly amazing and your best contribution is to try and slow him down. Remember that the key to victory against another sniper is for him to not see you before you take your shot, which means finding hard angles for him to see (that he won't readily be expecting) and if that fails and he counter-snipes you, do NOT take another shot from that same position again.
One important thing to understand as a sniper - and I get flak for this, mostly from CS kids - is that full-charge shots are instant kills to certain classes no matter where you make your hit. Those are classes 150 health and under: scouts, spies, medics, engineers, and (sometimes most importantly) other snipers. However, these classes will sometimes be stocked with "overheal" from an opposing medic - given that only the medic is actually a 150 health class (the others are 125) this still means you will very often get a 1-hit kill at full charge on a body shot. Be wary of taking those shots against enemy medics as even 1 point left in their overheal will prevent the kill (though if they are simply too hard for you to headshot, still take the shot and either let them risk dying with their remaining life or try to scare them into potentially wasting an ubercharge). Don't be ashamed to take full-charge body shots on the other classes; it's a significant advantage to be able to 1-hit kill anyone on the opposing team from any visible distance.
As for more general tactics, one thing to try to keep in mind is that you shouldn't let yourself get tunnel vision and sit somewhere zoomed in where you will likely not be able to take a shot for a significant amount of time. If you have no targets and don't know where the enemy is currently engaged, you need to be moving to find a new angle. Furthermore, when you are zoomed in, try to keep your "dot" away from plainly visible walls that an enemy is going to be facing when they are making their approach, as they can see that dot and will start actively looking for new routes. This essentially starts to defeat your purpose before you ever get to take your first shot. It's not always a bad thing to "take up roost" somewhere if you know your flanks are safe and there is no long-range challenges, but don't waste it by signaling to the enemy what line of sight you have.
Keep yourself mobile as much as possible. If your team is on the offense and pushing up, you need to be moving up too - most often, your best chances at "open land" shots (where the enemy is in a vulnerable section of play field without significant cover) occurs in the heat of a hectic assault by your team. Never be looking to hang back and pick off stragglers, as this is very rarely a valuable tactic in TF2 gameplay. Stragglers mean those players are "offside" (away from whatever the current valuable point on the map is) and you also likely are if you have a clean LOS on their position. On defense, usually a sniper's best hunting ground is a LOS directly on the active point, or looking slightly beyond it in the enemy's direction. It is especially valuable if you have a LOS on a point where the enemy has to turn a corner just before approaching the current "active" point, because that is where they are going to look to activate their ubercharge and where you can make big plays for your team by sniping an enemy medic just a second before that assault happens. Those are shots worth taking even if you think it will mean giving up your position to the enemy as it removes a significant amount of time from the enemy's clock regaining that ubercharge, or forcing them to make the push without it.
If you find yourself getting backstabbed (or headshot if you're wearing the Razorfail) too often, it probably means you're simply too far back from where you need to be and are easy spy food. Often times, if a decent spy wants to kill you and they haven't been properly spy checked, you are simply going to die - you want to make it so that there is every chance they will get immediately killed by your team for doing so. In that sense it is often good to be within a friendly sentry's range, but never plant yourself right next to a sentry as you'll be a priority target for the spy if he comes in for a sapper. You also may simply be revisiting "roosts" too often and making yourself predictable for a spy running his back-end routes. This plays in to not being zoomed in all the time; if you're not zoomed you can switch to your kukri and take a swing at any friendly player that comes near your current spot. Often a spy will panic and literally back up if you switch to melee and approach them; if you see that warning sign, you need to switch to your Jarate (or, if you do not have that yet your SMG) and spy check them immediately. Jarate is perfect for this because if it hits an enemy spy it will short out their cloak, making them a very easy kill for your team even if they manage to kill you with their revolver.
Long story short - keep your feet light, your aim true, and play the map like a nomad rather than a settler.