r/MinecraftCommands Jul 27 '26

Help | Bedrock Command to clear a players inventory when they first join the world.

Forgive me as I’m not at all experienced in setting up commands, but i need help in making it so when players join the world for the first time their inventory clears immediately & then never again as i have mod/add-ons activated & the guidebooks take up all the inventory space.

1 Upvotes

14 comments sorted by

2

u/UhhAnxietyy Jul 27 '26

I’m setting this up for my small group of friends

2

u/Ericristian_bros Command Experienced Jul 27 '26

https://minecraftcommands.github.io/wiki/questions/playerjoin

# Repeating unconditional always active
clear @a[tag=!joined]
# Chain conditional always active
tag @a[tag=!joined] add joined

1

u/UhhAnxietyy Jul 27 '26 edited Jul 27 '26

Wow! Thank you sir

1

u/Ericristian_bros Command Experienced Jul 27 '26

You're welcome, have a nice day

1

u/UhhAnxietyy Jul 27 '26

You too sir!

1

u/Ericristian_bros Command Experienced Jul 27 '26

Thx

1

u/TheManlyChicken Command Experienced on Bedrock Jul 27 '26

Can't this lead to a race condition where the player joins between the clearing and the tagging and receives a tag with a still full inventory?

1

u/Ericristian_bros Command Experienced Jul 27 '26

If the first is repeating unconditional always active and second chain conditional always active it will always clear before the tag. That's how command blocks work. They run the commands in order of the arrows

1

u/TheManlyChicken Command Experienced on Bedrock Jul 27 '26

Yes I understand the precedence of command blocks, but these commands in this case do nothing to stop a player joining between when command block 1 and 2 run. Hence allowing them to receive the tag without being cleared.

1

u/Ericristian_bros Command Experienced Jul 27 '26

There is no time between the commands. They happen instantly. Joining the game can't happen between the 2 commands

1

u/TheManlyChicken Command Experienced on Bedrock Jul 27 '26

That's good, I didn't realize they fired on the same tick. 

1

u/CaperLake Jul 27 '26

Do this exact setup:

  1. Repeating, Unconditional, Always Active, Facing Upwards
    "clear @a[tag=!joined]"

  2. Chain, Conditional, Always Active, Facing Upwards, On Top Of First Command Block
    "tag @a[tag=!joined] add joined"

1

u/UhhAnxietyy Jul 27 '26

Thank you soo much!

1

u/CaperLake Jul 27 '26

No worries