How can I know when the player is turning?

How can I detect when the player is turning left or right? Currently, my system just sees if the X or Z axis is looking left or right then it’ll tilt the model to the left or right, but this doesn’t really work that well as they could just be looking the way and the model would still be tilting to the left or right if they were just facing the left/right, so I am wondering how I can know if they’re actually turning left or right at that moment. Here’s my current code:

Thanks!