how would i play a sound when a variable reaches a certain amount?

im trying to use the code below to play a sound when the player score is 10 but the game wont load in.

function preload(){
this.load.audio('finish', 'audio/complete.mp3');
};

function create(){
if (this.player.score == 10){
    this.play.sound('finish');
};
};

You should put the if statement inside the update function or on the portion of the code that increments the score, not on the create function like you did.