so as I mentioned it just seems to not run because the entire code segment is executed super fast and the motor’s last instruction is to brake. You’ll need to utilize multitasking/threading if you want to use your code as is and still drive. copy the code in your if statement and put it into a function. then, in your if statement call the function like this: thread(functionName).detach();.
This tells the brain to continue executing the main function while simultaneously running the other.
This might help: One Thing Runs But Everything Else Stops
EDIT: note that using this method you do not need the ‘false’ param as if it is there the same issue occurs and the brain runs through your function at lightspeed and brakes almost immediately