Camera not rotating alongside player character after new script.
Hello! I've added a new script to my camera so it always stays by the head bone of my character's armature, but doesn't bob alongside the animation
https://gyazo.com/ade131d0a9c6d372855f0ac879556c62.png
And it works... for the most part-
You can see near the end of the gif, it rotates independently of the character
https://gyazo.com/04934a8d91c3a7b9e7d989a43887abdb.gif
If you disable the script, it works perfectly fine (Minus the camera not moving when you crouch.)
https://gyazo.com/79f6642f491bd1b00fc0709f4eb6977a.gif
Whats going on here? (By the way, the camera is parented to the character, I've tried making it a child of the head bone but it breaks when I rotate straight up or straight down, and bobs alongside the head.)
update: After making it only copy the Y axis it works, but without Z it cant push forwards with the head and as such clips through the character/looks at the character from behind at a lower angle.)