All commands
📜
Advanced

/function

Run a list of commands stored in a datapack function file.

Try in Simulator

At a glance

Syntax

Syntax
/function <namespace:path>
commandtargetcoordsvaluerequiredoptional

See it

What it does

/
Command executed

Anatomy

Every part, explained

  1. 1
    /functionCommandRequired

    Runs a datapack function.

  2. 2
    <namespace:path>Function IDRequired

    The pack and path, like mypack:setup.

Your turn

Try it yourself

Playground
2 tokens · press Enter to run

Copy & paste

Examples

/function mypack:setup

Run the setup function.

/function mypack:loop

Trigger a loop function.

/function minecraft:tick

Call the built-in tick function.

Avoid these

Common mistakes

/function setup
/function mypack:setup

Always include the namespace before the colon.

/function mypack/setup
/function mypack:setup

Use a colon between pack and path.

Keep going

Related commands