I have a variable that I want the program to continuously check its value

I have a variable that I want the program to continuously check its value. the code goes something like this:

var score = 1

if (player touches the star) 
{
    player moves to bottom of screen
score = score + 1
}

if (score == 2)
{
   a bunch of images.x = 1300
`your text`}

this is obviously not the real code (i use javascript with phaser library) but i hope that you get the idea

i tried changing the place in the code where if (score == 2) { a lot of images move off screen} but it did not work. I even put the places where the images .x properties were mentioned inside if (score > 2) if statements but it did not move the images no matter what. I think that the only way to fix this is to constantly check the score variable.