After the failed attempt the action terminates. You should use a loop that doesn't break after the player is in the distance but when the every condition to the door opening is met. Like this:

Code:
while(!player)wait(1);
while(1)
{
if(vec_dist(player.x,my.x) <=80 && totalPoints >= 200)break;
}