Kinda with Syd on this one.
The battery can run the lights, but not have enough to crank properly.
The clicking is usually not quite enough juice hitting the solenoid to kick the starter over.
It can be a bad starter just not moving, but more commonly it's a battery or a corrosion issue.
Wouldn't hurt to pull the battery, clean the contacts, maybe check it under load and see if it's just lacking, maybe check the contacts all the way up the line. One of mine did have a bit of corrosion from being stored ion a porch vs. a garage. I went through and cleaned all the contacts I could see and had a much happier bike (I did get it a new battery too).