Simple recoil script solved

How could I make a gun recoil script which works but attaching to the main camera and when I press left mouse button the script just moves the camera back and fourth slightly? Been trying for ages and no luck thanks :slight_smile:

awesome, post your code and we’ll have a look at it and see where you’re going wrong :smile:

Deleted my code but I was thinking if I make an animation where the gun kicks up then down again and then I just need a script which plays the animation when I press the mouse button?

dont worry now, got it working :slight_smile: For anyone thats wondering I made a recoil animation and attached it to the gun object then written a script to play the animation when the mouse button is pressed