Hi,
let's assume the following situation: Person A and B are allied to each other, while C is their opponent, and the order of initiative ist A, B, C.
A attacks C in melee, and B attacks C with a ranged weapon (crossbow, etc.).
C is flat-footed, has not acted yet, and does not get an AoO. So...