Hi.
There are a few ways i can think of.
For example :
Have an array called (for example) "occupied".
once a player is on a square add it to the occupied array by using 'Array Add'.
When the player selects a square, use 'Array Contains' and check with the selected square.
When a character leaves a square, use 'Array Contains' and store the index.
Then use 'Array Delete At' with that index.