Is it ok to change the shaft of a fisherprice motor?

Rule 49. A. states that "the mounting brackets and/or output shaft/interface may be modified to faciliate the physical connection of the motor to the Robot and actuated part.
So is it ok to change the shaft of a fisherprice motor to fit the motor inside the frame??

Do you mean the FP motor, or the plastic gearbox? The gearbox is not integral with the motor, and you can do whatever you want with it.

Or do you mean something else? your question isn’t very clear, because we don’t know how it sits in relation to the frame that you’re talking about.

If you are referring to the motor only, you can modify the shaft, you may not replace it. That would require opening the motor which violates the do not modify rule. As Jim has pointed out above, the transmission (the black plastic with white output couplers) is not considered part of the motor and is therefore entirely modifiable.