0

I am creating a function pack for the bedrock edition of Minecraft. In one of the commands, I want to give the tag ‘test’ to @s (the player running the command) if they do not already have the tag and remove ‘test’ if they already have it.

How would I do this?

1 Answer 1

2

The following commands should do the trick:

execute @s[tag=test] ~ ~ ~ tag @s add has_test
execute @s[tag=!has_test] tag @s remove test
execute @s[tag=has_test] ~ ~ ~ tag @s add test
tag @s remove has_test

The logic is basically that if it has the tag, it will remember it for the whole command chain then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.