When the ball is hit, a sensor in the bat would send a signal that would release the clamp and the players would now be able to move anywhere they want.
After the batter is out, has stopped at a base, or has crossed home plate, the defense would move back to their clamps to be ready for the next pitch.
Elon Musk is probably working on it right now.
___________
That's fantastic.
Those two were the finest hitters I've ever seen in my lifetime. Nobody ever played a shift against them because it would have been pointless. Heck -- fielders served a whole different purpose when those guys were at the plate. The fielders were there to keep them to a single when they put the ball in play. :-)