Small Issue with Child Light

Hey Guys,

I’m fairly new at scripting and I have this small script.

var flickerSpeed : float = 0.07;
var LightChild : Light;
private var randomizer : int = 0;

while (true) {
    if (randomizer == 0) {
        light.enabled = true;
        LightChild.enabled = true;
    }  
        else light.enabled = false;
            LightChild.enabled = false;
        randomizer = Random.Range (0, 1.1);
         yield WaitForSeconds (flickerSpeed);  
}

All I want it to do is have the child light turn off when the parent light that the script’s attached to turns off. The effect I am currently getting is the child light is just turning off permanently.

HI,

I didn’t try your code but look here:

as you didn’t use {} else take care only the first line and enable your main light. LightChild is always false.
So try :

It must do the job as you want.

Ah that did work. Simplest of errors haha thanks man.