Assalamualaikum, me and my friend were talking about something and some people said I am better at something than my friend and I said just as a joke to him that learn from me, I don't think I had intention of mocking him and he also knew it was a joke. Will this still be haram?
One can joke without putting anyone else down.
E.g. if you respond with something like "If I'm better at it, that's because he's a better teacher than I am.", it doesn't put anyone down (except possibly yourself).
The humour comes from the language itself, making people have to think about what you said so they can figure out why it makes sense, or doesn't.
Showing respect will earn you respect; showing disrespect will earn you disrespect.
Whether haram or not, wit is always better than a cheap shot.
First, I want to thank you for your keenness to learn about halal and haram.
A person who has knowledge always wants to increase it, and he continues to learn until he dies.
It is better to be considerate of other people's feelings.
Do this method with your friend in front of them. Try to highlight something your friend is good at.
These things over time will make your friend sad