Minecraft – How to give potion effects to everyone on a certain team

minecraft-commandsminecraft-java-edition

So I'm making a kind of kit PVP game called classes, where you join a team, let's say, the barbarian. You can't hit any other barbarians, and it shows everyone else with the same class. But I want people with certain classes to have special effects how do I do that?

I tried:

/effect 1 1000000 5 @a[barbarian]

But it didn't work. I am running 1.9

Best Answer

Selector parameters consist of a unique key name and a value, separated by an equals sign, with each unique parameter separated by a comma. The team parameter is what allows you to target players based on their team. For the /effect command, the target comes first:

/effect <player> <effect> [seconds] [amplifier] [hideParticles]
/effect @a[team=barbarian] minecraft:speed 1000000 5

See also, Minecraft Wiki: Target selector arguments.