Minecraft Blogs / Tutorial

[1.13+] Making Custom Shops and Currency

  • 33,417 views, 9 today
  • 22
  • 19
  • 32
Dudamesh avatar Dudamesh
Level 61 : High Grandmaster Senpai
Welcome to my Minecraft 1.14 Tutorial on how to make Custom Shops and Custom Currencies

Making Custom Currency

First of all Let's introduce you to a certain command: Scoreboard

Basic Info about Scoreboard
[1.13+] Making Custom Shops and Currency

The scoreboard system is a complex gameplay mechanic utilized through commands. Mainly intended for mapmakers and server operators, scoreboards are used to track, set, and list the scores of entities in a myriad of different ways.

/scoreboard keeps track of certain variables for example: totalKillCount

Today I'll be showing you How to make your own Currency using a certain criteria.

First of all we'll make a "scoreboard objective"

[1.13+] Making Custom Shops and Currency

/scoreboard objectives add <name of your objective> <criteria> [<displayName>]

There are several criteria you can make for your custom Currency such as "dummy"

"dummy" objectives' values can only be changed using commands or Command Blocks

you can use "dummy" criteria for your Custom Currency if say you only want the players to get their money by pressing buttons to activate command blocks

However in this tutorial, we will use the criteria "totalKillCount" so that our Custom Currency increases everytime we kill any entity

[1.13+] Making Custom Shops and Currency

right now in that command, I named my objective as "Currency" however there is still the <display name> argument but I've already named my objective?

the objective name is used when you're calling on that objective to modify it or set a player's objective to a certain number.

the display name is only what you see when you put the scoreboard on a display

For now we won't tackle the [<display name>] because it uses Custom JSON formatting

I've Entered the Command but nothing happens when I kill an entity?

the value is actually changing for you in the background, to see it more clearly let's put it on the sidebar display

the sidebar is an argument on what display the objective will be put on, some other examples of displays is "belowName" and "list"

But in this tutorial we will use "sidebar"

I entered the command but I can't see the objective anywhere?

The objectives only display if any player *has* a value for that objective, wether it be 0 or 999 or 1283169265

Since our criteria is "totalKillCount" let's get a value for you by killing any entity

try summoning a villager and kill it.

Notice on the right side of the screen my name has appeared with 2 Currency

that means I've killed 2 entities since the creation of the objective

Congratulations, You've created your own Custom Currency!

But wait, how do I modify the value of my own Currency?

What if I want to cheat work hard and gain lots of money?

Modifying Values of Scoreboard Objectives

So now we have a Scoreboard Objective: Currency which counts the total number of kills that player has

How exactly do you modify the value of players' objective values?

Now we'll be going to /scoreboard players... command

to modify the players' objective values

There are alot of commands for modifying players' objectives but in this tutorial we'll be focusing on "set", "add", and "remove"

Let's say you wanted to reward a player for completing a quest, he gets 10 Money for completing the quest, does that mean you give him 10 chickens to kill to increase his scoreboard objective value?

It's simple:

/scoreboard players add @p Currency 10

what is @p? it is an argument for which target to select for your command, in @p it targets the nearest player to the player using the command, if a player enters that command then naturally the command will target the player himself there are many possible values such as @a (all players), @e (all entities), @r (random player) any many more.

/scoreboard players remove...

removes a certain specific value to a player's objective value

/scoreboard players set...

sets the player's objective value to another specific value

Great! Now you know how to modify a player's Objective Value!

Making Custom Shops

Now that we know how to modify a player's objective value.
We can simply hook some remove commands to @p and give them a certain item for it.

"But of course it's not always that simple"
is what you would expect me to say but actually we can make a very (not profitable) Shop if we do exactly that

For example:

Let's make a shop for a Golden Apple for only 10 Currency

Based on what we've learned so far

we only need 2 Command Blocks

/scoreboard players remove @p Currency 10

/give @p minecraft:golden_apple 1

would remove 10 Currency from the nearest player and immediately give 1 golden apple for his Currency

Now, try and get 15 Currency (or type in /scoreboard players set @p Currency 15)

Now we have enough money to buy One Golden Apple, so try and press the button.

Great it works this is it for the tutorial!...
Actually try and press the button once more, this time you don't have enough Currency

As you can see, the system works EVEN if the player does NOT have enough Currency

Now we'll delve deeper into how to target players who have enough Currency

Let's go back to the argument for targets on the scoreboard

As you can see, placing a square bracket "[" in front of the target argument provides us with more options to specify which target to pick

for our case, we need to target players with a certain score which is 10 or above/color]

That means only players with 10 or above Currency can activate our Shop

As you can see, we can use @p[scores={}] to specify our targets more

Since our Scoreboard Objective's name is Currency we put in @p[scores={Currency=}]

Then since our Shop needs 10 or more Currency, we put in "10.."


Notice how there are 2 dots in front of the 10, this signifies as 10+ or "10 or above"

This means this command will target the nearest player with 10 or more Currency

let's integrate this into our earlier prototype shop

(Note: Make sure the second command block is set to Chain, Conditional, Always Active.)

Set your Score to 15 again, and try pressing the button 2 times.

Now the shop relies on if the command block is able to find the nearest player with 10 or above Currency, then remove 10 Currency from that player and give the nearest player a command block if the first command block was able to run perfectly.

That's it for the tutorial on making a simple Custom Shop

However I will be going further into detail on making more Robust and Advanced Shops

Custom Display Name for Scoreboard Objective

This is the same Currency Objective used in the previous part of the tutorial

The only difference is the displayname argument

the displayname argument in 1.13 now uses JSON formatting for more customization. This means you can make the text bold, italic, obfuscated or with color.

The basic format for JSON is simply {"text":"<message>"}

you can add more to customize your text such as "color":"<color>" or "italic":"<true/false>"

For what I have used in the picture above

I used this: {"text":"$ Cash $ ","color":"green","bold":"true"}

You can make even more complex JSON formats in this website

Making More Robust and Advanced Custom Shops

Right now if you have finished the above tutorial, you should have a basic Shop where it searches for the nearest player with 10 or above score and remove 10 score from them, and then giving the nearest player a golden apple
What if the nearest player that has 10 or above score is more than 1000 blocks away
and then the system will remove 10 cash from that player 1000 blocks away, BUT there is another much more closer player to the shop who doesn't have 10 or above cash
The system will give the golden apple to ONLY the nearest player IF the first command block runs perfectly

It's not robust meaning it can fail in certain situations

Going back to our target arguments

we can further specify targets who are close to the shop

Using what's known as distance=

if we set our target as @p[scores={Currency=10..}] earlier, we only need to add a comma and add one more value to further specify our target

Notice how I used "..4" in the distance, this means the nearest player within 4 blocks, if you set it to just "4" that means it will only look for players exactly 4 blocks away

Now we have solved the problem of the system finding players who aren't the exact target due to range.

There are a number of things we can still improve in this still basic shop

For example, if the system does not find any players within 4 blocks who have 10 or more cash, it will not give anyone a golden apple.

Which by itself has no problem. But how exactly will the players know IF the system did NOT find any player who fits in the description?

let me introduce you to the command /tag which can not only improve the robustness of the shop even more, but also allow you to add more commands into the shop, adding more features. And even discriminate the players who has or who doesn't have enough cash so you can execute commands for those specific players.

/tag is such a wonderful addition to the 1.13* command set

It allows you to tag any player with a specific tag and use @p[tag=<tag>] as a discriminator for players.

What exactly can we do with tag to further improve our shop?

Let's rewrite our commands from the earlier command blocks on our simple shop.

* Note: Guide was made in 1.13

/tag @p[distance=..3,scores={Currency=..9}] add notEnough

as you can see, this command tags the nearest player within 3 blocks and with a currency score of 9 or below with a tag called notEnough

this means that the player tagged with this tag does not have enough cash to buy the item.

What can we do with a tag?

we can kill that player for being ignorant of signs clearly saying you need 10 or more cash to buy this item

we can summon a baby zombie with a speed and strength effect near that player

But enough joking around, how exactly do we execute a command on that player?

well simply set up two command blocks, one repeating and one a chain uncondtional.

The repeating command block has this command:

Or any command that you want to happen to that player!

using @a[tag=notEnough] means any and all players with notEnough tag will get that command zapped straight to them

BUT we're not done! (Because if you tag yourself with /tag @p add notEnough you will get this:

Why did this happen? Because the command block is set to Repeating to @a with that tag: notEnough

So how exactly do we stop the command from spamming us with reminders of how poor we are?

Remember I told you to setup another command block with an unconditional chain setting?

Simply we need to remove that tag after we've done what we want to that player with that tag!

This will remove the tag from all players with that tag.

Let's go back to our Shop, so far we've set it up so that whenever there is a player within 3 blocks who doesn't have enough cash be told that they do not have enough cash to buy that item.

Let's go to the next step, what if the player has enough cash

Like what we've done in the previous section:

We can tag a player to thank them for buying.

Then if the player has enough cash, using a combination of these commands:

then tagging the player with tyBuy we can also thank the player for purchasing that item!

You can instead, tag the player with a tag like buyGA and make a seperate command set for players with that tag

Then run these commands in a repeating command block:

/give @a[tag=buyGA] minecraft:golden_apple 1

then a chain command block

/scoreboard players remove @a[buyGA] Currency 10

and finally remove the tag on another chain command block

/tag @a[tag=buyGA] remove buyGA

Or if you want to thank them before removing the tag.

/tag @a[tag=buyGA] add tyBuy

That's all for this Tutorial, it has been pretty long and this has been done in only one sitting.

Make sure to leave a Diamond if you found the Tutorial helpful.

*shameless tagging*
how to make a shop in minecraft
people are still viewing my old tutorial but not this new one :(

2 Update Logs

Update #2 : by Dudamesh 08/02/2018 10:04:35 pmAug 2nd, 2018

some text got auto-formatted displaying the wrong text

Create an account or sign in to comment.

11/16/2020 3:43 pm
Level 1 : New Miner
Lego12 avatar
im making a youtube video how to make a minecraft tycoon. do you know how to make the scoreboards private like lets say instead of it saying

player1 100
player2 90
player10 830

it would say like if this player is the one playing it would say just there user like when you look on player8 screen it says

player8 200

while every one else has there own name so It doesn't overload the scoreboard with millions of names.
08/15/2020 8:55 am
Level 1 : New Miner
DeadlyVinni avatar
/tag @p[distance=..3,scores={Currency=..9}] add notEnough

Doesnt work for me im on java edition 1.16.1
08/25/2020 10:31 am
Level 61 : High Grandmaster Senpai
Dudamesh avatar
that's quite weird, a quick search on 1.16 or 1.16.1 changelog on minecraft gamepedia shows no change to the command format of /tag, perhaps a bracket error? do let me know what happened
11/04/2019 4:45 pm
Level 1 : New Miner
fabian232 avatar
nvm it works im just stupid xd
11/04/2019 4:04 pm
Level 1 : New Miner
fabian232 avatar
uhm can someone help me please when i press the button it takes my money but when i hit 10 currency it doesnt take the money and it still gives me the item please help.
07/31/2019 8:20 pmhistory
Level 1 : New Miner
MattyRuss06 avatar
How to sell multiple items of one, such as 32X cobblestone? I'm on Xbox so not all the command will be the same, but I got the you can't afford this working so maybe I could get selling 32x of an item working, just need the command
08/30/2019 3:15 pm
Level 33 : Artisan Architect
Chris6d avatar
It doesn’t work on Xbox, only Java edition
08/03/2019 7:44 pm
Level 61 : High Grandmaster Senpai
Dudamesh avatar
as you said, console version is not similar in commands. But there should be an argument for amount of items to give a player.

In PC it is:
give <player>[selectors>] <item>[<NBT>] [<count>]

In Bedrock Edition it is:
give <player: target> <itemName: Item> [amount: int] [data: int] [components: json]

so a simple command in Bedrock edition (I assume) will be:
/give @p minecraft:cobblestone 32

I do not know how to put specifications on the target argument in bedrock edition. Try and explore on your own or use the wiki :>
08/10/2019 6:41 am
Level 1 : New Miner
MattyRuss06 avatar
Thx for the help but I want to know how to sell 32x cobblestone, cos even when I have 20 cobblestone, it just gets rid of it and you get no money, rather than it not taking the stone and not giving you money
08/16/2019 4:32 amhistory
Level 61 : High Grandmaster Senpai
Dudamesh avatar
I see the problem, in this case, you can use the nbt argument in the player selector (the @p[stuff here] )

the specific NBT tag you're looking for will be the Inventory tag, so you have to type this in your player selector: @p[nbt={Inventory:[{id:"minecraft:item_name"}]}]
you can use any selector and not necessarily @p
there are no quotes outside of the selector, only after the id:

However, I am unable to provide any answers on how to count the number of items in the inventory using the selector arguments, usually it would be id:"minecraft:item_name",Count:15b or so but 1.13+ changes a lot of things

What you can do, is clear 1 at a time and set a score for the player on how many he has sold, if it reaches the required amount, then he will get the money for that items. If not, then the score counting up can be reused to give back the number of items lost.

For example: (again, I'm not very sure with what I'm writing here since I can't test it)

/clear @p minecraft:item_name 1

then run a conditional chain command block after it

/scoreboard players add @p b 1
where b is the scoreboard dummy objective

then run a repeating command block to scan for players who have the required amount of items

/execute as entity @p[score={b=15..}] run scoreboard players add @p[score={b=15..}] Currency x
where b is scoreboard dummy objective
where x is amount of money gained by selling the items

then a conditional commandblock with the same /execute command but the run command is different

/execute as entity @p[score={b=15..}] run scoreboard players add @p[score={b=15..}] b 0

to reset the counter.

I hope this helps :>
Planet Minecraft


© 2010 - 2022