How do I change variables on an object when it's clicked on?

So currently I want to create a system where I have a box that can be clicked on by player 1 or player 2. Should player 1 click on it I want to set my integer to 1 and if player 2 clicks on it i want the integer to go to -1. I also only want this to happen if the integer is currently not equal 1 or -1

Use void OnMouseDown () to tell if it is being clicked, and add a bool to see whose turn it is. If i understand your game, two players take turns tapping a box on one screen, correct? If so, this should work.