I'm trying to use command blocks in minecraft so that 'new players' can get a starter kit by clicking a button.

The problem is, I don't want this to be abused and I only want the command to be triggered if the user has never clicked the button themselves.

Is there a mechanism to do this? And if so, how? (Note I'm new to command blocks, but not to Minecraft in general)

  • Did you try using scoreboard?
    – bco2135
    Dec 2, 2022 at 1:10
  • @bco2135 yeah I tried, but I guess I'm not sure how to set a default value if the user has never joined the server or not. I guess I could do a test to see with an always-active command block to set specific achievements on join since I'm using a hypixel SMP (so op commands are semilimited, or I"d be using tags). Dec 2, 2022 at 3:05

2 Answers 2


Thanks to bco2135 in comments for starting to steer me in the right direction. Thanks to their suggestion to leverage scoreboard and customized objective tracking that way, this has allowed me to get limited execution on items in a single command block properly. There's follow-up for me to do here in additional questions, but at least the first part is handled here.

Effectively, I have to do the following (assumes: cheats and op mode):

  1. Add a dummy objective I want to track

    /scoreboard objective add Tracker dummy Tracker
  2. Use an always active command block to add 0 to all players (effective on join) for this objective

    /scoreboard players add @a Tracker 0
  3. Use an execute if entity conditional in the command block able to be triggered by a button:

    /execute if entity @p[scores={Tracker=0}] run ...

    ... specifying of course the command to execute when this is true.


There are two other ways of doing this that I know of. You'd have to use the '/tag' command. In the commands that you give the player the items, have it check the player's tags.

Let's do the easy one first:

At the command block, the button activates to do

"execute as @p if entity @s[tag=!starterkit] run give @p ..."
"execute as @p if entity @s[tag=!starterkit] run tag @p starterKit

This command checks if the closest player does not have the tag starterKit. If the player doesn't have the tag, they get the item. Then then the last chain commands gives them the tag starterKit.

To reset just do:

/tag @a remove starterKit

This version is more for getting one item, it should only be used when the player is in a secluded space so that the person that clicks the button is always the closest to these command blocks.

This command set is more advanced I recommend it for multiplayer mode so nothing goes wrong:

Have the button activate the command:

/execute as @p at @s run tag @s[tag=!starterDone] add starterKit

'/execute as @p' makes the closest player the target of the command 'at @s' means run the command at the target 'run' means the target runs the command. Basically, tell the target(closest player) to do the command, similar to when you type the command in chat. 'tag @s[tag=!starterDone]'
'!' means don't. So the target checks to see if they don't have the tag starterDone. 'add starterKit' adds the tag starterKit to the target(closest player)

Then somewhere else have a repeating command block that starts a chain of command blocks. All the command blocks will have this command:

/give @a[tag=starterkit,tag=!starterDone] ...

This detects all the players that have the tag 'starterkit' and don't have the tag 'starterDone'

Then have an extra chain command block at the end that has the command:

/tag @a[tag=starterkit,tag=!starterDone] add starterDone

This gives the player that gets the item the tag starterDone so the button won't work for them anymore

To reset this command set, just do these commands in order:

/tag @a remove starterKit
/tag @a remove starterDone
  • Unfortunately, /tag is disabled on the server I am playing on (Hypixel SMP apparently disables tags). So the scoreboard route is the one I used, but I've tested this in a vanilla local server on my network and it seems to work well. Dec 10, 2022 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .