How do I give a Player money when they kill someone else? [closed]

Solution 1:

First you would need to create a scoreboard to keep track of when a player kills another player. Run this command once to create a scoreboard that goes up by one every time a player kills another player.

/scoreboard objectives add pvpKill playerKillCount

Then on a clock run these two commands to give a player a diamond when they have a kill, and then reset their player kill score

/give @a[score_pvpKill_min=1] minecraft:diamond
/scoreboard players remove @a[score_pvpKill_min=1] pvpKill 1

If you're creating a virtual currency you would need to run this command once too

/scoreboard objectives add money dummy

Run this once for each player to give them a starting score of 0 (assuming they're not all online at the same time)

/scoreboard players add @a money 0

Then instead of the earlier two commands on a clock, run these two commands on a clock. This will give them 1 virtual dollar for every player they kill, but you could easily change the first command below from 1 to 100 or whatever you want to add.

/scoreboard players add @a[score_pvpKill_min=1] money 1
/scoreboard players remove @a[score_pvpKill_min=1] pvpKill 1