Depending on how the sliding mechanics is implemented, it might be as trivial as disabling Control Rotation on the Pawn’s Character Movement Component but leaving it on for the Camera; or as complex as you made the sliding to be.
Control Rotation
Character Movement Component
Camera