Teaching children kindness but also that others feelings about them are not their problem

How do I explain to my child that they should be kind to others, but also that other’s kindness towards them is not a reflection of them? I want my kids to know that they should be kind to others and treat them with compassion, but all of my reasons for that contradict my lessons on other’s feelings, actions, and words are not a reflection of my child and to not own it as theirs (and essentially “allow it” to hurt their feelings).