- Home /
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;
     }
 }
}
Answer by AlucardJay · Jun 26, 2013 at 04:49 PM
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;
 }
Your answer
 
 
             Follow this Question
Related Questions
Play Sound on trigger 2 Answers
Detect if out of trigger 2 Answers
I want my trigger sound only to play once! 0 Answers
Play sound on trigger, sound is coming from the trigger 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                