You can only clamp one component of the vector at a time the way we did in the video. Double check you are only working with one vector component:
velocity.x = clamp(velocity.x, ...) and NOT velocity = clamp(velocity.x, ...) or velocity.x = clamp(velocity, ...). That should clear the error.
Yeah it turns out I missed specifying the x and y values in -max_speed. Meaning they should have been -max_speed.x and -max_speed.y. Thanks for the help!
You're welcome, glad this helped!