I have a snippet of code I wrote to require the player to have 2000 points in order to open a door. It works fine if the player walks upto it with 2000+ points and and works by not opening if the player has less than 2000 points. My problem is that after the player walks up to the door and fails to open it (not enough points), once I get more points, I cannot go back and open it.

here is my code.
Code:
action doorU()
{
	while(player==NULL) {wait(1);}
	while(vec_dist(player.x , my.x) >80){wait(1);}
	if(vec_dist(player.x , my.x) <= 80)
	{
		if(totalPoints >= 2000)
		{
			beep();
			totalPoints -= 2000;
			ent_remove(me);
		}
		else
			return;
	}
	else
		return;
}