M HYPE SPLASH
// news

How to give potion effects to everyone on a certain team

By Andrew Adams

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

3

2 Answers

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.

/effect @a[team=teamname] 1 1000000 5 would set an effect to all players on a certain team, where teamname is the name of the team that you want to give the effect to.

1