I'm trying to make a minigame where when someone presses a button they join a team and teleport somewhere. I then want a chain command block to give them a book, but I want a specific team to get that item. Whenever I try doing it, it gives it to the wrong person.

I tried to use this command:

/give @p written_book 1 0 {author:Narrator,title:WereWolf,pages:["\".The goal of the werewolves is to decide together on one villager to secretly kill off during the night, while posing as villagers during the day so they're not killed off themselves."]}

I want to give the book to a certain team, but whenever I do like @a[team=Red] It doesn't work


You can use /give @p [r=40,x=X coordinate,y=y coordinate,z=z coordinate], followed by the item. Make sure to set x, y, and z to the middle of where each team spawns, assuming it’s a room. If not, do [r=5].