I'm making a kit pvp and am using scoreboard as my points.

How do I make it so when a player is standing near an item, it gives them 1 point then the item disappears?


Here is just "an item":

execute @e[type=item] ~ ~ ~  scoreboard players add @p MYOBJ 1
kill @e[type=item]

Or for an item named Apple:

execute @e[type=item,name="Apple"] ~ ~ ~ scoreboard players add @p MYOBJ 1
kill @e[type=item,name="Apple"]

The first command should be in a repeating always active command block and the second in a chain always active conditional.

  • wouldn't this be inconsistent as the items might be killed before they are able to be used to execute the command? – DM01131 May 5 at 18:55
  • @DM01131 no, a chain conditional command blpck only executes after the repeating command block. Ill edit that in for clarification – Penguin May 5 at 20:29
  • Oh ok I understand now - sorry I thought both commands would be in repeat command blocks or one would be in a normal chain (not conditional). While unlikely though, isn't there still the potential for two instances to occur, creating a glitch? Would you say this is too unlikely to pose a potential problem? – DM01131 May 6 at 21:02
  • @DM01131 that wont ever happen i have used these sorts of systems with long strings of command chains and they never have once failed – Penguin May 7 at 3:40
/execute as @a store success successscore to 1* run clear @s *youritem*  
/*add point too* [scores={successscore=1..}]  
/*set scoreboard of [scores={successscore=1..}] back to 0  

These are not the exact commands, but you get the point

  • 1
    It's better to post working, tested commands so that the reader doesn't need to figure out how to write the commands. Figuring out the correct syntax is the better part of a question like this. It's also not clear how to make this code run repeatedly, or where/how it is ran (I assume a repeating command block is involved?). – aphid Apr 22 at 12:22
  • This is wrong none of these commands would work – Penguin Apr 22 at 16:56
  • 2
    These commands look like they are for Java edition, the tag on the question is for bedrock edition. – DM01131 May 3 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.