Cannot read properties of undefined (reading 'add')

I tried to make my code into a function and got this error.

Cannot read properties of undefined (reading ‘add’).

const fingerMovement = () => {
  if (playComputer) {
    Finger.visible = true;
    this.tweens.add({
      targets: Finger,
      x: 50,
      y: 600,
      duration: 1000,
      onComplete: () => {
        diceButton1.emit('pointerdown');
      }
    });
  }
};

this.tweens is undefined, probably because this isn’t the scene in this context.

You need to call it like

fingerMovement.call(this);

from a scene method.

Thanks, resolved