How to create fake players for scoreboards/setup scoreboard

I've looked and can't figure out how to do it, I'm trying to make a Karma system for my map and I want to use the fake players trick. I'm trying to make a good and bad karma system where the player presses a button to get 1 good karma point or presses the other button to get a bad karma point so that if the player looks at the scoreboard on the side it will show their good and bad karma points I already have the scoreboard setup which I named Karma just need to know how to do the other parts.


Solution 1:

This is possible: a fake-player or a variable ist with this makeable:

/scoreboard objectives add KARMA dummy

/scoreboard objectives setdisplay sidebar KARMA

(the score "KARMA" will be show, if one a button is pushed)

Button1:

/scoreboard players add good_karma KARMA 1

Button2:

/scoreboard players add bad_karma KARMA 1

The points will be add not set.

Solution 2:

Things could have changed drastically since 2017, but since the OP asked about "fake players" I'm surprised by the comment stating "what do you mean fake players?"

It seems common in using commands to store values (aka variables) using the scoreboard command. This could be done 2 ways:

  1. Create an objective which will store a value for each player and can be manipulated by commands or in-game events. A simple example is "Death Count" or "Zombies Killed".
  2. Create an objective with the "dummy" criteria which can only be changed by commands.

For 2 to work, you can add "fake players". This way you can have multiple "variables" with separate values, but the in-game mechanic is to essentially have the variables appear on the scoreboard using the scoreboard players... command. Hence, "fake players". (Player names that start with # do not show up on the scoreboard displayed on the screen).

As per the Scoreboard page on Gamepedia:

Score is only changed by commands, and not by game events such as death. This is useful for event flags, state mappings, currencies,...

I've attached an image of the suggestion by @user191708: Displays command blocks to add and remove scores for good_karma and bad_karma displayed on a sidebar scoreboard for the Karma objective.

I'm just learning commands now to work with datapacks in 1.15/1.16+ so if anyone can explain it better I'd love suggestions and more knowledge.