shake screen

Oke i am beginner and i need help about shake screen .Shake screen is important for my game cos it is horror and witch is chasing you and i need that shake.I managed to make 1 script that is shake on a button but i wana change that to witch trigger or cube trigger on anything trigger here is my script pls some1 help me

static var shakeInt = 50.0;
var decrease = 5.0;
var magnitude = 5.0;
function Update () {
if (shakeInt < 0){
shakeInt = 0;
}
if (shakeInt != 0){
shakeInt -= 1decreaseshakeIntTime.deltaTime;
}
var cam = camera.main.transform;
if (shakeInt > 0){
cam.rotation.x += Random.Range(-magnitude
shakeInt, magnitudeshakeInt);
cam.rotation.y += Random.Range(-magnitude
shakeInt, magnitudeshakeInt);
cam.rotation.z += Random.Range(-magnitude
shakeInt, magnitude*shakeInt);

if (Input.GetKeyDown(“q”)){
shake.shakeInt = 20.0;
}
}
}

What you would need is to create a GameObject, add a BoxCollider check the Is Tirgger Box on that collider, have a Rigidbody/CharacterController on your player and add a script to gameobject.

In the script you would want to use the ‘OnTriggerEnter’ function.

w8 w8 w8 i dont understand where i need to make this script i want to make it on cube to practise what i need to add to my cube and what i need to add to my script that i copy on top?