have a wait at the very start of the loop, at the end of your loop set a variable to the current location of the player
after the wait but before setting that variable check if the player location is different to the one in the variable, if it is, you know that between that tick the location of...