## help me

1 messages · Page 1 of 1 (latest)

near ferry
#
system.runInterval(() => {
    for (const player of world.getPlayers()) {
      if (player.hasTag("smnt")) {
        if (player.getScore("smnt",(7..))) {
          player.runCommand("scoreboard players add @s smnt 1");
        } else {
          player.runCommand("scoreboard players set @s smnt 0");
          player.removeTag("smnt");
        }
      }
    }
  }, 1);
#

added , (comma) when calling the getScore function

#

If it still doesn't work, then you need to explain more detail about these things:

  • Send your getScore function
  • Player class do not have a native method getScore()
bold dome
#

error

deep spire
deep spire
# bold dome error

use this

import {Player} from '@minecraft/server'
Player.prototype.getScore = function (objectiveName){
  return world.scoreboard.getObjective(objectiveName).getScore(this.scoreboardIdentity)
}
//Example Use
if(player.getScore('Random Objective') === 3){
//DO something
}
near ferry
#

honestly, why doesn't he just use the matches method and use the EntityQueryOption for scores

bold dome
#

error in 7.(.)

near ferry
#
const testOption = {
    scoreOptions: [
        {
            minScore: 7,
            objective: "smnt"
        }
    ]
}
system.runInterval(() => {
    for (const player of world.getPlayers()) {
      if (player.hasTag("smnt")) {
        if (player.matches(testOption))) {
          player.runCommand("scoreboard players add @s smnt 1");
        } else {
          player.runCommand("scoreboard players set @s smnt 0");
          player.removeTag("smnt");
        }
      }
    }
  }, 1);
bold dome
#

full error

#

8 error

near ferry
#

send error

#

lazy to test

bold dome
#

in vs code

near ferry
#

bruh

bold dome
near ferry
#
const testOption = {
    scoreOptions: [
        {
            minScore: 7,
            objective: "smnt"
        }
    ]
}
system.runInterval(() => {
    for (const player of world.getPlayers()) {
      if (player.hasTag("smnt")) {
        if (player.matches(testOption)) {
          player.runCommand("scoreboard players add @s smnt 1");
        } else {
          player.runCommand("scoreboard players set @s smnt 0");
          player.removeTag("smnt");
        }
      }
    }
  }, 1);
#

removed that extra )