Would you recommend taking the train from Monaco to Lucca, Italy or got to a larger city first then the Lucca?
In your six and a quarter hour journey you will change trains in Ventimiglia (15 minutes), Genova Piazza Principe (Genoa, 45 minutes), and Viareggio (24 minutes).
Which larger city do you want to visit on the way?
Lucca is quite small and far from any border, I doubt it is served by direct trains from Southern France.
The only direct IC train from Ventimiglia to Viareggio calls at Sanremo, Genoa and La Spezia (Cinque Terre).
What city do you want to visit? Maybe you want to visit Nice or Genoa??? A lovely small town to spend a night or two between Monaco and Genoa is Noli.