You didn't mention 6 or 7 or........., so I'll assume it's 5 speed.
Modern 5 speeds tend to be on the bottom end bikes and frequently will never shift both ways properly.
You get it to work upshifting and it's crappy downshifting or the reverse. Sometimes both ways.