Currently I'm trying to create a system that only allows certain command block events to trigger once to each person. Rather than setting up a system at the spawn to set the starting value for the points objective for each new player to 0 I want to create a series of command blocks to check if the player's points value is less than a certain number (to prevent them from triggering it multiple times). I hope that it could also apply to undefined starting values, that way new players could still trigger it the first time as well.

I've come up with an unsuccessful solution

/testfor @a[score_points_min!=1]

and would appreciate any assistance with this predicament.

6 Answers

There is no score_points_max argument. The score_points argument selects entities with scores less than or equal to the value. Therefore, the solution is

testfor @a[score_points=0] 

However, this will not work for players with no score at all. You will need to use

scoreboard players add @a points 0 

to give players with no score a score of zero. Alternatively, you could tag players once they max out their score, and only apply the trigger to players without the tag.

if you want exact try:

testfor @a[score_points=1,score_points_min=1] 

etc for whole setup do:

/scoreboard objectives create points dummy /scoreboard players add @p points 1 /testfor @a[score_points=1,score_points_min=1] 

For example to make trails for specific points you would put this in repeating always active cblocks:

/execute @a[score_points=1,score_points_min=1] ~ ~ ~ /particle dripLava ~ ~ ~ 0 0 0 0.001 100 normal @p /execute @a[score_points=2,score_points_min=2] ~ ~ ~ /particle totem ~ ~ ~ 0 0 0 0.001 100 normal @p 

If you want to make it so when you reach max it goes back to max do it like this:

Say your max is 100,

You place a repeating always active cblock:

/execute @a[score_Example=101] ~ ~ ~ /execute @p ~ ~ ~ /scoreboard players set @p 100` 

This may work. Repeating always active cblock:

/scoreboard players add @a[score_Scoreboard=0] [Scoreboard] 1 

Anyway more detail:

/testfor @a[score_points_min!=1] 

doesn't work as it's got a ! instead of it tracking for a min of one and a max of one. Such as my other ones, But if you read my other examples it should help you.

If you want a kill counter, You can do the cmd for the kill counter

First do:

/scoreboard objectives add Kills playerKillCount Kills 

Now place a cblock (always active and repeating) with /execute @p[score_Kills_min=1] ~ ~ ~ /scoreboard players add @p [Dummy] 1

Now do a chain onto it with /execute @p[score_Kills_min=500] ~ ~ ~ /scoreboard players set @p[score_Kills_min=500] Kills 0

I am aware that some of them are not required but that doesn't affect the commands.

/testfor @a[score_points_max=1] should work. And for new players, dummy objectives already have a default value of 0. But if you want to test for a null value, you can always use @a[score_points=].

3