- Home /
Question by
SterlingStudios · Jun 13, 2014 at 08:37 PM ·
gunif
Problem with "if" statements
Hi. I have a problem with multiple items under an "if" statement. I want all of these to happen. Here's the code:
function GunFX () {
if(Input.GetMouseButtonDown(0) && canShoot == true)
gunShotFX.active = true;
yield WaitForSeconds(1);
gunShotFX.active = false;
audio.PlayOneShot(gunShotSound);
}
Comment
Answer by paul_hayes · Jun 13, 2014 at 08:45 PM
Put the lines into a set of curly braces like so:
function GunFX () {
if(Input.GetMouseButtonDown(0) && canShoot == true){
gunShotFX.active = true;
yield WaitForSeconds(1);
gunShotFX.active = false;
audio.PlayOneShot(gunShotSound);
}
}
Your answer
Follow this Question
Related Questions
Problem with "if" statements 1 Answer
Problem with "if" statements 0 Answers
Basic Shooting Game 1 Answer
Help with Lerp 0 Answers
Network Shoot/health script 0 Answers