One of the buttons wont stay high

Hello. I have a problem that one of the buttons(in this code mygt) wont start counting points. Where have i made mistake?

int myg = 7;
int mygt = 8;
int sk1 = 0;
int skai = 0;
int state = LOW;
int reading;
int previous = HIGH;
int statee = LOW;
int readingg;
int previous1 = HIGH;
long time = 0;
long debounce = 200;
long debounce1 = 200;
void setup() {
pinMode(myg, INPUT);
pinMode(mygt, INPUT);
Serial.begin(9600);
}
void loop() {
reading = digitalRead(myg);
readingg = digitalRead(mygt);

if (readingg == HIGH && previous1 == LOW && millis() - time > debounce) {
if (state == HIGH)
state = LOW;
else
state = HIGH;
}

if (reading == HIGH && previous == LOW && millis() - time > debounce) {
if (statee == HIGH)
statee = LOW;
else
statee = HIGH;
}

if (state == HIGH)
{
skai ++;
statee = LOW;

}

if (statee == HIGH)
{
sk1 ++;
state = LOW;

}
Serial.println("Team1");
Serial.println(skai);
Serial.println("Team2");
Serial.println(sk1);
previous = reading;
previous = readingg;
delay(1000);
}

When is previous1 LOW?

    previous = reading;
    previous = readingg;

Whoops

Also, do you have any pulldown resistors on the inputs to keep them in a known state or are they floating at an unknown voltage ?

Thanks UKHeliBob for your help it works now after about 4 hours of trying to find whats wrong ;D Both buttons have 10k resistors.

after about 4 hours of trying to find whats wrong

I'm glad it works, but the time you took looking for the problem serves you right for using variables with similar and meaningless names :slight_smile: