a flag can not function

      float time=millis();

Back to the documentation for you. millis() does NOT return a float.

void setup()
{
  // snipped some stuff
  delay(3000);
  // snipped some more stuff
}

void loop()
{
  // snipped some more stuff
      float time=millis();
      if (time>500)
      {

After diddling around in setup for 3000 milliseconds, how can millis() possibly return a value less than 3000?