I found the most helpful thing to be to make goals for myself to improve myself or my life.
'Having a good time' frequently doesn't really have much of a deeper meaning and may just be a superficial appearance.
Finding a goal for yourself and making a real impact on your own life is more meaningful than whatever 'good time' the other person is having.
Start going to the gym, learn a new skill, focus on getting sober, join some sort of club or activity, etc.