TransWikia.com

Do something after changing scoreboard stats

Arqade Asked by Gleb on February 8, 2021

I want to execute a command when scoreboard stats change or when added to stat. And tell me about gates in command if possible. I do it in datapack. For example: a player kills 100 zombies and earns an extra heart or an item. I’m bad at creating and using scoreboards, but remember that I can use selector like so:

give @s[scoreboard."name" = 1] minecraft:stone

Or someone gives a tag when scoreboard stats matches.

One Answer

Target selector arguments have changed in 1.13+. Your commands seem like they are from 1.12 and below. 1.13 changed the way to test for scores drastically.

Now, testing for scores looks like this:

/give @p[scores={score1=1..3,score2=3..5}] diamond_sword

This command says: Give a diamond sword to the closest player who has a score1 between 1 and 3 and a score2 between 3 and 5.

This should work in 1.16 as well.

The double dot is the range indicator. Here are some different ranges.

  • 0..5: between 0 and 5 inclusive
  • ..5: up to and including 5
  • 0..: 0 and above

Answered by ExpertCoder14 on February 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP