MIAMI (AP) – Udonis Haslem went out a winner, and put on a show.

Haslem scored 24 points in his final regular-season game, Duncan Robinson added 20 and the Miami Heat tuned up for the play-in tournament by topping the Orlando Magic 123110 on Sunday.

It was Haslem’s highest-scoring game since he had 28 points on Nov. 14, 2009. He checked out for the final time with 58.9 seconds left, getting the last of many ovations that rained down throughout the afternoon.

Haslem was 9 for 17 from the floor, 3 for 7 from 3-point range. It was Haslem’s 1,026th game – including playoffs – and he’s only scored more points in two of them.

And Haslem became the first 42year-old to score 24 or more points in a game. Kareem Abdul-Jabbar was three days past his 41st birthday when he scored at least 24 for the final time; no one had been older than that in such a game, until Sunday.

This story would never have been told if Udonis Haslem’s mother hadn’t moved from Miami to Jacksonville. Or if his stepbrother hadn’t been so smart about an airball. Or if Atlanta signed him in 2002. Or if San Antonio did in 2003.

Any of those things happen differently, it all changes. He probably wouldn’t be with the Miami Heat right now. Maybe never.

Haslem, the NBA’s oldest active player at 42 and a three-time champion, is in the final days with his hometown team. He’s the third player to spend a two-decade career with one franchise, joining Dallas’ Dirk Nowitzki and the Los Angeles Lakers’ Kobe Bryant.

"All I’ve ever tried to do is take care of my people, take care of my city," Haslem said. "I think that’s why I can sit down with the mayor and commissioners, or I can sit down with people in the ‘hood, and be comfortable either way. It’s because of the sacrifices that I’ve made for this city." Heat President Pat Riley is more succinct.

"Udonis is Miami," Riley said.

Haslem was on the NBA’s All-Rookie team in 2003-04. He never was an All-Star, never All-NBA, never even a player of the week out of 438 possible chances. The last time he averaged double figures for a season was 2009.

But ask anyone with the Heat, and they insist Haslem – the team captain who’ll have his No. 40 jersey retired next season – has been vital for two decades.

"He’s the poster child of a guy who was average, supposedly, and yet he became great," said Chet Kammerer, who has spent 27 years in Miami’s player personnel department. "And how did he do that? Hard work. Great spirit. Great attitude. Never ‘can’t do this,’ never ‘can’t do that.’ And the success that we’ve had, he’s had more of a major contribution over the whole 20 years than people know. " Take the night Miami won its first NBA title in Dallas in 2006. Haslem played with a separated shoulder. He had to guard Nowitzki, the Mavericks’ best player. Nowitzki didn’t have a field goal in the fourth quarter; Miami won 95-92, Haslem had 17 points, 10 rebounds and a good cry afterward.

"The champagne got me," he said. Everyone knows otherwise; they were tears.

Other players got headlines that night; Dwyane Wade was Finals MVP, Shaquille O’Neal won his fourth ring. But without Haslem, there would be no title.

"He’s always had tremendous courage," Riley said. "Whatever endeavor, he rises to another level. And you need that. He was for real. He was that kind of man, someone who has tremendous pride being from Miami."

Many Miami kids grow up with football dreams. Haslem was one of them. But when his mother took a job in Jacksonville when he was 9, focus began shifting to basketball. (”Football isn’t as big there,” Haslem said.) When he was around 12, Haslem was on the court with his older stepbrother, Sam Wooten. Haslem shot an airball. Wooten caught the ball and scored.

"Nice pass," Wooten said, genuinely. He, and that moment, had tremendous impact on Haslem; Wooten died in 1999 from cancer and Haslem has a ”R.I.P. Sam” tattoo on his neck to pay tribute to his mentor.

Haslem had backboard-breaking dunks as a high school freshman, starred at Miami High, then starred at Florida but struggled with weight and NBA teams passed on drafting him in 2002. Atlanta brought him in for a camp that summer, but signed Ira Newble to its last roster spot instead.

So Haslem played in France, dropping the extra weight by eating only turkey sandwiches. The next summer, he was offered a one-year contract by the Spurs.

"We couldn’t lose him," Kammerer said.

The Heat offered two years. Haslem signed. He never left. He had multiple chances, often for more money. But he stayed and will remain with the organization in a to-be-determined role; Haslem wants a chance to join the ownership group.

"He’s monumentally important for our organization and our locker room,” Heat coach Erik Spoelstra said. "He embodies everything that we believe in. And he has a way, because of the respect level, that he’s able to influence and mentor literally every player in the locker room.” There are many stories of Haslem’s toughness. He’d dislocate fingers in practice and pop them back in like nothing happened. People still talk about his hard foul on Indiana’s Tyler Hansbrough in the 2012 playoffs, after the Pacers caused him to get eight stitches the game before and Hansbrough had just sent Wade flying. He often is the one giving impassioned locker-room speeches at halftime, even before Spoelstra gets a chance. The wall outside Miami’s locker room is now a tribute to Haslem moments.

He’s not Miami’s best player. It could be argued nobody has meant more.