Sound sensor signals with time bracket
Your handling of millis() is wrong. With these two lines:

unsigned long StartMillis = millis();
unsigned long CurrentMillis = millis();


StartMillis will always have the same value as CurrentMillis. (Ok, I guess its possible for millis() to return a value that's increased by 1 the second time it's called, but that is extremely unlikely. The 2 lines takes much less than a millisecond to execute.)

Your 

while ((CurrentMillis - StartMillis)==5000) 


will never evaluate to true, so the code in the while block will never execute.

This if statement is also wrong:

if (digitalRead(sensor)=0)


You want == (comparison) not = assignment. I'm surprised the compiler even allowed that to compile, since you are trying to set the function digitalRead(sensor) to 0, which doesn't make sense.

Change that code to read:

if (digitalRead(sensor)==0)


(Assuming you want the body of the if statement to execute when your sensor value is 0.)