Weapon Viewmodel Rotation Sway

I don’t know how to make a sway with a rotation, I tried but it gives a lot of errors

here is an example of what i want

Thanks in advance!!