BOSTON — Good luck writing a script better than this.

Paul Pierce already had been given a standing ovation and a touching tribute during Sunday’s game between the Celtics and Los Angeles Clippers, Pierce’s final contest in Boston before he retires at the end of this season.

But somehow, his perfect farewell became even more perfect.

After repeated chants from the TD Garden crowd to put Pierce back in the game, Clippers coach Doc Rivers finally obliged, subbing the veteran forward in with 19 seconds left in regulation. What happened next was something out of a Hollywood movie.

Pierce, who started but had been planted on the bench since the first quarter, drilled a 3-pointer with 11 seconds remaining, sending the TD Garden crowd into an absolute frenzy.

They were the only points Pierce scored in L.A.’s 107-102 loss, but it marked a storybook end to the Celtics legend’s time in Boston.

“I’m glad I was able to cap it off,” Pierce said after the game. “My last game in the Garden, at least I can say I put one last bucket in.”

That moment didn’t look like it would happen as Clippers hung around in the fourth quarter. But after several persistent “We want Paul Pierce!” chants echoed through the Garden and the Celtics took a three-possession lead with 19 seconds to play, Rivers put Pierce back on the floor one last time — “because the fans made me,” Rivers quipped.

“Him making that shot just, that’s just — I don’t know what the heck that is,” Rivers said after the game. “That only happens here — I don’t know who can sit that long and walk in on the floor and make a shot.”

The Truth, that’s who.

Thumbnail photo via Bob DeChiara-USA TODAY Sports