Explosion Jumpscare Script ?

Does anyone know what i did wrong with this ?

var sound : AudioClip;
var Aftermath : Particle;
var SingleUse : int = 0;

Aftermath = GetComponent (“Particle”);

function Start () {
Aftermath.enabled = false;
}

function OnTriggerEnter (collision : Collider); {
if (SingleUse == 0); {

	if (collision.gameObject.tag = ("Player")) {
    audio.clip = sound;
	Audio.Play();
	Aftermath.enabled = true;
	SingleUse == 1;
	}
}

}

Yes, there a two problems in your question :

  • you didn’t format your code
  • you didn’t say anything about what the problem was i.e. where it was not giving the desired result

Please read / watch :

So at a complete guess , there are three problems with your code :

  • you are trying to use a command outside of a function Aftermath = GetComponent (“Particle”);
  • you have put a semicolon after function OnTriggerEnter (collision : Collider)
  • you have assigned the value to SingleUse incorrectly SingleUse == 1;

Functions look like this :

function Start () 
{ 
    Aftermath = GetComponent ("Particle");
    Aftermath.enabled = false; 
}

function OnTriggerEnter (collision : Collider)
{
    // ....
    SingleUse = 1;
}