Rotate yaw with () problem after rotate past 180 degrees?

I’m trying to make a part of my character rotate (Yaw) but after it rotate past 180 degrees, it went to the longer rotate path to 0 then -179 degrees rather than rotate straight to the desired point.

The code below was taken from someone who made a tutorial of how to smoothly rotate actor which I couldn’t remember where I took it from. However, the problem when rotate past 180 degrees still exist.

Got everything sorted out by fixing the input relative speed value. is working normally.