Attack Rolls
RuleMelee attack rolls use Strength as their attribute modifier by default. If you're using a weapon or attack with the finesse trait, then you can use your Dexterity modifier instead.
Melee attack roll result = d20 roll + Strength modifier (or optionally Dexterity modifier for a finesse weapon) + proficiency bonus + other bonuses + penalties
Ranged attack rolls use Dexterity as their attribute modifier.
Ranged attack roll result = d20 roll + Dexterity modifier + proficiency bonus + other bonuses + penalties
When attacking with a weapon, whether melee or ranged, you add your proficiency bonus for the weapon you're using. Your class determines your proficiency rank for various weapons. Sometimes, you'll have different proficiency ranks for different weapons or groups of weapons.
The bonuses you might apply to attack rolls can come from a variety of sources. Circumstance bonuses can come from the aid of an ally or a beneficial situation. Status bonuses are typically granted by spells and other magical aids. The item bonus to attack rolls comes from tracking weapons.
Penalties to attack rolls come from situations and effects as well. Circumstance penalties come from risky tactics or detrimental circumstances, status penalties come from spells and magic working against you, and item penalties occur when you use a shoddy item. When making attack rolls, two main types of untyped penalties are likely to apply. The first is the multiple attack penalty, and the second is the range penalty. The first applies any time you make more than one attack action during the course of your turn, and the other applies only with ranged or thrown weapons. Both are described below.