The aim of the game is that there will be two teams facing each other, with a shop system at the spawn of each team. The currency of the shop will be by paying using emeralds. I want to make that each time a player gets a kill on an enemy player, the killer will receive 3 emeralds, and when one team gets 100 kills, that team wins the game.
I've already added the teams to the scoreboard, but I don't know how to make that whenever a team reaches a hundred kills the team wins, and I also don't know how to give an emerald to a player that recently killed an enemy.
Best Answer
If each player has individual scores, the first step would be to add them all up into one cohesive team score. One way to do this would be to use a fake player for each team.
Setup:
Run whenever you want to update the scores:
This will create two scores in
teamScore
. One namedred
with the combinedenemyKills
scores of everyone on thered
team, and one namedblue
with the combinedenemyKills
scores of everyone on theblue
team.To test if a team has won:
will test if the red team has won, while
will test if the blue team has won.
Obviously, you don't have to use
red
andblue
for the team names, and you could do this for more teams if necessary. And you don't need to useenemyKills
for your scoreboard objective, the names were just arbitrarily chosen and could be any valid name.Hope this helps! If you find anything unclear, just comment below.