Camera flinch?

How do i create a camera effect so when i get hit by a racyast, the camera flinches so i know ive been hit?

If you dont understand, I am talking about a call of duty type effect.

If you mean shaking try this(adjust the values for the effect you’re looking for):

public float power = 0.7f;
public float duration = 1f;
private Transform CameraTransform;
public Transform Player;
public float SlowDownAmount = 1f;
public bool ShouldShake = false;

Vector3 StartPosition;
float InitialDuration;

void Start()
    InitialDuration = duration;

void Update()
    CameraTransform = Player.transform;
    StartPosition = CameraTransform.localPosition;

    if (ShouldShake)
        if (duration > 0)
            CameraTransform.localPosition = StartPosition + Random.insideUnitSphere * power;
            duration -= Time.deltaTime * SlowDownAmount; 
            ShouldShake = false;
            duration = InitialDuration;
            CameraTransform.localPosition = StartPosition;