Only the best attack against each enemy counts, so Squad Strategy is the key! If two players attack the same enemy base and one person gets one star and the other gets two, the Squad only receives two stars (not three). This is to prevent everyone from attacking the easiest enemy bases.
And what about green and grey lines: If two players attack the same base and one person gets 90% 4-stars and the other gets a 60% 1-star, the Squad's best attack will be noted as the 90% 4-star attack and 1 stars won't be counted. (So the line for the second attacker will be shown in "grey" color). If two players attack the same base and one person gets 100% 5-stars and the second person gets a 100% as well, the Squad's best attack will be the first attack only. Those the second person won't get new any stars. And in this case the line for second person will be shown in "grey" color as well.