Timer on delay?

i changed the code like you wrote it, there were errors when it was compiled but fixed them. Had to move your code around a bit to make it all work. everything is working right except for the time. does not do a full 10 seconds, only approx 3 max

this is my whole program but the problem lies with the //alarm 10 sec delay i believe

// constants won't change
const int bluePin = 10;
const int greenPin = 11;
const int redPin = 9;
const int speakerPin = 5;
const int motorPin = 6;
const int temperaturePin = 0;


// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0; 
long interval = 100;
unsigned long tempdelay;
unsigned long checktime;
long temperature;

void setup ()
{
  pinMode(bluePin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(redPin, OUTPUT);
  pinMode(speakerPin, OUTPUT);
  pinMode(motorPin, OUTPUT); 
  pinMode(temperaturePin, INPUT);
  
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor 
                       //last button beneath the file bar (looks like a box with an antenae)
}
 
void loop()                     // run over and over again
{
 if (millis() - tempdelay >= 500){
  tempdelay = millis();
  float temperature = getVoltage(temperaturePin);   
  temperature = (temperature - .5) * 100;         
  Serial.println(temperature);
                                    //waiting a second
 
//blue LED 
    if (temperature <= 20){                              
      analogWrite(bluePin, 127.5);
      analogWrite(greenPin, 0);
      analogWrite(redPin, 0);
      analogWrite(motorPin, 0);
     }
    else if (temperature > 20 && temperature <= 23){
      analogWrite(bluePin, 191);
      analogWrite(greenPin, 0);
      analogWrite(redPin, 0);
      analogWrite(motorPin, 0);
    }
    else {
      analogWrite(bluePin, 255);
      analogWrite(greenPin, 0);
      analogWrite(redPin, 0);
      analogWrite(motorPin, 0);
    }
//green LED    
    if (temperature > 26 && temperature <= 30){  
      if (temperature > 26 && temperature <= 27.3){      
          analogWrite(bluePin, 0);
          analogWrite(greenPin, 127.5);
          analogWrite(redPin, 0);
          analogWrite(motorPin, 127);
           }
       else if (temperature > 27.5 && temperature <= 28.5){
          analogWrite(bluePin, 0);
          analogWrite(greenPin, 191);
          analogWrite(redPin, 0);
          analogWrite(motorPin, 127);
          }  
        else {
          analogWrite(bluePin, 0);
          analogWrite(greenPin, 255);
          analogWrite(redPin, 0);
          analogWrite(motorPin, 127);
        }
  }
//red LED    
int LEDFlag =0;  LEDFlag = 1;

    if (temperature > 30 && temperature <= 32){          
      analogWrite(bluePin, 0);
      analogWrite(greenPin, 0);
      analogWrite(redPin, 255);
      analogWrite(motorPin, 255);
      LEDFlag =0;
     }
    else if (temperature > 32){
      analogWrite(bluePin, 0);
      analogWrite(greenPin, 0);
      LEDFlag = 1;
     
    
     
     //alarm 10 sec delay
   if (LEDFlag = 1){
      if (millis() - checktime >= 10000){
        checktime = millis();
        tone(speakerPin, 200);
       }
   }
      
     
        //led flash     
        unsigned long currentMillis = millis();
        if(currentMillis - previousMillis > interval){
        // save the last time you blinked the LED 
        previousMillis = currentMillis;   

        // if the LED is off turn it on and vice-versa:
        if (ledState == LOW)
        ledState = HIGH;
        else
        ledState = LOW;

        // set the LED with the ledState of the variable:
        digitalWrite(redPin, ledState);
        }
        
  analogWrite(motorPin, 255);
  
  
   }
 else {
     LEDFlag =0;
     noTone(speakerPin);
     }
 }
}

/*
 * getVoltage() - returns the voltage on the analog input defined by
 * pin
 */
float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}