Fredoops is right.
The transmission (or pin in the transmission) doesn't like being stressed (ie, to move in one particular direction if the car has the tendency to move in another direction (in a slope)).

To reduce this (when changing direction on a slope) you could use the park brake or your foot brake (and accelerate a little) when you travel the opposite direction of where the car wants to roll.

If you park you car on a slope it is a good idea to let the park brake take the rolling tension instead of the transmission. So you stop, pull the park brake, let the foot brake go for a milli second (car will roll a little to the direction of the slope) and put in park on your transmission.