Florence is an easy day trip from Bagni di Lucca. There are several ways to get there. The train is convenient. It can be boarded in Fornoli. The trip takes about 25 minutes to get to Lucca, where you change trains for Florence. The more direct train takes about 1 hour 20 minutes, add 25 minutes for the train that makes more stops along the way.
You could also drive to Lucca, park beside the station and take the train. This offers more flexibility for the return journey as the return connections are not great.
I used to recommend the bus from Lucca, but it no longer goes right into the centre. The bus stops beside a tram stop which is one stop from the centre, making it slightly less convenient.
Clever Mark Hickman has found another way. There is a car park just outside the centre with a tram connection into the city. Touch the photo below for details.
Thank you Mark, I look forward to trying it.