Tic Tac Toe MinMax not working correctly

Hey everyone.

Could someone take a look at my Tic Tac Toe game. I have the minMax function working, it is just not returning the optimal results. Basically it just plays on the next square available from top left to bottom right. I am not sure what is going on with this thing.

Thank You.