Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
This is for my server, and I am trying to make it so that you can run around with your items, but can't place any blocks to grief. How do I do this with command blocks?
You could change there gamemode to adventure when they are in the are of your spawn.
this could be the simplest way to do what you need.
One solution is to have a fill clock constantly cloning a regular lobby onto the one where the players are. This prevents people from making changes to your spawn, if you really want to use commands and commands only to do it.
If you want to prevent them from destroying blocks, you can just apply the effect mining fatigue with a lever higher of 5 on every player near the spawn with a command block.