You need to be careful with ELSE IF. It is easy to make a logical nonsense.
I would only use that for a few mutually exclusive options.
You are using leftSpeed in one place and rightSpeed in another and I suspect that isn't logically correct.
I suggest you take a pencil and paper and write out a table showing all possible permutations before you decide how to write the code for it.
If you are trying to establish the states for a pair of motors it might be better to do that directly by having a couple of variables (for example motorLeft = 'F'; motorRight = 'R'; etc). Then, and separately, you can have a neat little function that reads those variables and makes the motors move appropriately. I don't reca;; what sort of motors you are using, but it may even be possible to make it simpler if a single number can define the direction and speed.
...R