testfor a fake player on a scoreboard

testfor a fake player on a scoreboard - Free stock photo of adult, basketball, basketball player

I'm trying to testfor if a fake player called MobHunger on a scoreboard objectives that is Stats. I tried this:

/testfor MobHunger[score_Stats_min=1,Team=Mob_Hunger]

but it doesn't work... any ideas?



Best Answer

(I assume you are on 1.8+) Since you cannot test for a player that isn't in game, Try using an armorstand.

First, Summon an armorstand with the nbt tags NoGravity, Marker, and CustomName. (Ex. /summon ArmorStand ~ ~ ~ {NoGravity:1b,Marker:1b,CustomName:MobHunger}

To set it a scoreboard, you can use an entity selector in place of the player. This would work: scoreboard players set @e[type=ArmorStand,name=MobHunger] stats 1

You can also use an entity selector in the testfor command, it's just a bit different syntax. /testfor @e[type=ArmorStand,name=MobHunger,score_stats_min=1]

Also, just a tip: try transitioning over to the execute command rather than testfor, as with testfor you need an comparator and a different command that needs to target the entity (unless you need that comparator for lag or other purposes). With execute, you can do a command in the same command if it finds the armorstand with a score of 1 in stats. Ex. execute @e[type=ArmorStand,name=MobHunger,score_stats_min=1] ~ ~ ~ setblock ~ ~ ~ stone is much more efficient than using a comparator.




Pictures about "testfor a fake player on a scoreboard"

testfor a fake player on a scoreboard - Kids Playing Baseball
testfor a fake player on a scoreboard - Person in White Nike Soccer Shoes Standing on Black Floor
testfor a fake player on a scoreboard - Man in Blue and White Football Jersey Shirt and Black Helmet



How do you test scoreboard?

The correct syntax for score selectors is /testfor (player)[scores={objective=number}] . However that command only selects one number. To select a minimum number you need to use a scoreboard test.



How to testfor a fake player -- MapMaking Tricks




More answers regarding testfor a fake player on a scoreboard

Answer 2

If you are on the 1.9 snapshots, you can use the scoreboard to test nonexistent players:
/scoreboard players test (playername) (objectivename) (min) (max)

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Kampus Production, Mason McCall, cottonbro, Alfo Medeiros