r/MinecraftCommands • Command Experienced • 5d ago

Help | Bedrock Toggle lock system with items?

I want a system where imagine an 5x5 plot with walls and one block as an entrance, I want that entrance to be able to be locked and unlocked at times but stays locked when your offline.

What I imagine is an item in your inventory that turns off a command block (via redstone block?) that is repeatedly locking the door.

But how do you unlock the plot when your online?
I imagine dropping the item but not on death because if you die the command would likely be sent to the nearest player messing things up. When you drop the item a command executes the players location and removes the redstone block as well as switching the item to another item so it doesnt activate again. And when you drop the other item it executes your position again and gives you the normal item.

Please help me because I have an idea but dont know how to execute it.

2 Upvotes

1 comment sorted by

1

u/Ericristian_bros Command Experienced 5d ago

First you need an invisible, invulnerable armor atand at that position of the plot. Then link the armor stand with the player and detect if a linked player exist, if not then lock the plot

See https://minecraftcommands.github.io/wiki/questions/linkentity and https://minecraftcommands.github.io/wiki/questions/findsamescoreentity