Enable command blocks and run functions on a server
Command blocks are off by default on a multiplayer server. Here is how to turn them on, which permission levels decide what they can do, when a datapack function is the better tool, and how both of them cost you performance.
6 min read · Updated Oct 21, 2026 · By GuavaHost Team
Turn command blocks on
A fresh server has enable-command-blocks=false, which is why a command block you place does nothing at all.
- Open your server at customer.guavahost.com and click Manage, then take a snapshot on the Backups page, because you are about to let blocks run arbitrary commands.
- Open the Server properties page under Minecraft tools and set
enable-command-blockstotrue. You can also editserver.propertieson the Files tab: editing server.properties covers both routes. - Click Save changes, then restart with Restart at the top of the page.
- In game, give yourself one with
/give @s command_block. You need to be an operator in creative mode to place and edit them, and how to op yourself covers getting op.
That setting is server wide, and vanilla has no way to allow command blocks in one world and not another.
The three kinds of command block
Right click a placed block and the top right button cycles between them. Which you pick is most of the performance story:
- Impulse (orange) runs once when it receives a redstone signal. The default, and what you want unless you have a reason otherwise.
- Chain (green) runs when the block pointing into it has run, which is how you order several commands precisely within one tick.
- Repeat (purple) runs every tick, twenty times a second, forever, as long as its chunk is loaded. The single most common cause of a mystery lag problem on a creative server.
There is also the Conditional toggle, which only runs the block if the one behind it succeeded, and Needs Redstone versus Always Active. A repeating block on Always Active is running right now, near you or not.
Permission levels, and what they gate
Minecraft has four operator levels, and two settings in server.properties decide what is available where. op-permission-level is the level a player gets when you op them, and defaults to 4, which is everything including /stop. function-permission-level is the level datapack functions and command blocks run at, and defaults to 2.
What the levels mean, roughly: level 1 bypasses spawn protection, level 2 unlocks most cheat commands (/gamemode, /give, /tp, /setblock, /summon, /effect) and command blocks, level 3 adds player management (/ban, /kick, /whitelist, /op) and level 4 adds server management such as /stop.
So at the default of 2, a command block can summon, teleport, give items and set blocks, but cannot ban a player or stop the server. Leave it there.
If a command in a block fails with a permissions message, it is a level 3 or 4 command. Find another way to do it rather than raising the level, because raising function-permission-level hands that power to every command block and datapack on the server, including anything a guest with creative built.
Setting op-permission-level below 4 is a neat way to give trusted staff /gamemode and /tp without /stop, though a permissions plugin is the better tool: giving staff the right tools and LuckPerms cover that route.
The gamerules that stop command spam
By default, a lot of command activity is broadcast to operators and written into the log. With a few contraptions running that is a wall of noise in chat and in your Console, and the log grows fast. Run these in the Console or in game:
/gamerule commandBlockOutput false
/gamerule sendCommandFeedback false
/gamerule logAdminCommands false
commandBlockOutputis whether command blocks announce their results to ops. Turn this off first; it is the noisy one.sendCommandFeedbackis whether commands reply with a confirmation at all. Turning it off quiets everything, including your own typing, so some people leave it on while building.logAdminCommandsis whether admin commands go into the server log. Leaving it on is a useful record of what staff did, so weigh the noise against that.
Using the console command box covers running these from the panel.
Datapack functions, the better tool for most things
A function is a plain text file containing a list of commands, run with one command. They live in a datapack, a folder or zip in your world's datapacks folder, and they do the same job as a chain of command blocks with several advantages:
- They are files. You edit them on the Files tab or over SFTP, and copy them between servers.
- They do not need a loaded chunk. A function runs when something calls it, wherever the player is.
- They are easier to read. Twenty commands in a file beats twenty blocks in a tunnel under spawn.
- They can run on a schedule properly. A datapack declares a tick function (run every tick) and a load function through its function tags, which removes the need for repeating command blocks entirely.
The rough shape of a pack is a pack.mcmeta file plus a data/<your namespace>/ folder holding your .mcfunction files, called with /function yournamespace:yourfile. The folder name inside has changed between pack format versions, and so has the format number you declare in pack.mcmeta, so check what your version expects rather than copying a years old example. Installing datapacks covers the folder, the pack format and the commands to list and reload packs.
/reload picks up changes to functions without a restart, though a brand new pack sometimes needs one to appear in /datapack list.
A command block is still right for anything triggered by redstone in the world: a door, a pressure plate, a shop, a minigame button. Use blocks for "when this redstone fires" and functions for "every tick".
What all this costs you
Commands are not free, and a few patterns are genuinely expensive:
- Repeating command blocks. Twenty executions a second each, so ten of them is 200 a second before anything has happened. Use chains off a single repeating block, or a datapack tick function.
- Broad entity selectors.
@ewith no filter asks the server to consider every entity in the world, so@e[type=zombie,distance=..10]is enormously cheaper than@e[type=zombie]. Always bound a selector by type and distance. - Expensive commands in a tick loop.
/fill,/cloneand large/setblocksequences every tick show up in your tick time immediately. - Redstone clocks. Each clock ticks constantly, and many around a map add up. A command block on Always Active replaces a lot of clocks.
- Chunks held loaded. Contraptions that keep running need loaded chunks, and those cost memory and tick time whether anybody is there or not: chunk loading and pre-generation explains the cost.
If your server has got slower and you suspect commands, do not guess. Run a spark profile and see what is consuming the tick: finding Minecraft lag with spark shows how to read the report, and command or function work usually shows up by name. If the profile points at entities instead, reducing entity and mob lag is the next stop.
Common questions
Why does my command block do nothing when I power it?
The most likely reason is that enable-command-blocks is still false, which is the default on a multiplayer server and needs a restart after you change it. If it is enabled, check the command is valid by typing it in chat first, and that the block is not conditional on one behind it that failed.
Should I use command blocks or a datapack function?
Use a function for anything that is a list of commands, runs on a schedule, or you expect to edit later, because it is a file you can read and change. Keep command blocks for what genuinely needs a redstone trigger in the world, like a button or a pressure plate.
Do command blocks cause lag?
Repeating ones can, because each runs twenty times a second forever while its chunk is loaded, and broad entity selectors make it worse. Impulse and chain blocks that fire occasionally cost almost nothing, so the fix is usually one repeating block driving a chain, or a datapack tick function.
Still stuck? Jump into our Discord at discord.gg/GuavaHost and the team will help you out.
- command-blocks
- functions
- datapacks
- minecraft
- java
Host a Minecraft Java server From $3.99/mo, with instant setup and DDoS protection.
Still need help? Our team is online 24/7 to answer questions.