DatapackJavaBedrock
/function
Run a datapack function file.
What is /function used for?
What /function is for
Runs all the commands in a datapack function file (.mcfunction), in order, in one call.
When to use /function
Bundle complex command sequences into reusable, named routines — the building block of datapacks, called by tick/load tags, /schedule, or other functions.
Syntax
Parameters
- name
- function ID
- Namespaced function, e.g. mypack:setup.
Command builder
Configure the options below to generate a ready-to-paste /function command.
Form namespace:path, e.g. mypack:setup.
Examples
Run mypack/data/mypack/functions/setup.mcfunction.
Common questions
Permission level
/function requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.