Lights shutting down with sound

Hi,
Im beginner with Unity, and even more with scripting i mostly modify the scripts i found.
What im trying to achieve is lights shuting down one after another, with sound effect connected to every shutdown of the light.

`#pragma strict
var light_down_0 : GameObject;
var light_down_1 : GameObject;
var light_down_2 : GameObject;
var light_down_3 : GameObject;
var light_down_4 : GameObject;

var played = false;
var trig = false;

var clickSound: AudioClip;

/////When player enters trigger/////// set to true///////
function OnTriggerEnter (other : Collider) {
%|1512355362_1|%
}
//////Enable renderer and trigger sound and timer/////
function Update () {
%|971779091_2|%
%|86938754_3|%
%|-166982660_4|%

%|-571540330_5|%
}
//// timer ////
function removeovertime () {
%|-1436862808_6|%
%|100986914_7|%
%|36113627_8|%
%|1401870186_9|%
%|-516028577_10|%
%|-825324713_11|%
%|1599428303_12|%
%|-445450465_13|%
%|1633754797_14|%
%|-1105708243_15|%
%|2036316252_16|%
%|-913393898_17|%
%|-2138975816_18|%
%|-1390553392_19|%
%|-1545792410_20|%
%|1846181786_21|%
}
//// sound /////
function makehimscream_0 () {
%|-1171808759_22|%
%|-1183411412_23|%
%|-2045067513_24|%
%|-1710635996_25|%
}

function makehimscream_1 () {
%|-451771264_26|%
%|-1682377517_27|%
%|7164834_28|%
%|1675370969_29|%
}

function makehimscream_2 () {
%|-1052795000_30|%
played = true;
%|2104514616_32|%
%|1598251606_33|%
}

function makehimscream_3 () {
%|384067722_34|%
%|500527016_35|%
%|323764729_36|%
%|1087399600_37|%
}

function makehimscream_4 () {
%|-539729754_38|%
played = true;
%|1249881886_40|%
%|1928674998_41|%
}
`
Light are shuting down correctly but I don’t hear the sound with second shutdown of the lamp.
Any ideas what im missing?

You are assigning the global variable “played” to true on the first sound. Then the rest check if played. Since played = true still, they never play.

Glancing at your code I don’t think you even need to check played since you are making separate function calls and the audio isn’t looping.