Run Commands from Behavior Pack Function Files
The /function command in Minecraft Bedrock Edition runs a list of commands saved inside a corresponding function file. This lets you trigger multiple actions at once with a single line of text.
Map makers and server admins use this command to run complex scripts from an active behavior pack. You must have cheats enabled and hold Game Directors permissions to run it.
/function <name: filepath>Function with file path
| Argument | Type | What it means |
|---|---|---|
name | filepath | Required. A command file path to a function located in a behavior pack. |
/function setupRuns a basic setup function file located at the root folder of your behavior pack.
/function kits/starterExecutes a function inside the kits folder to give players their starting items.
/function arenas/reset_pvpTriggers a function in the arenas folder to reset a player-versus-player area.
/function mobs/spawn_bossCalls a function inside the mobs subfolder to summon a custom boss creature.
/function minigames/parkour/start_timerRuns a nested function file to begin a timer for a parkour minigame.
/function quests/chapter1/give_rewardsExecutes a specific quest function to hand out rewards after completing chapter one.
In Minecraft Java Edition, the /function command has extra arguments that let you pass variables directly into the function using /function <name> [<arguments>], or pull data from a block, entity, or storage source using with block, with entity, or with storage.
Function files are stored inside behavior packs that you install and activate on your Minecraft world.
Yes, cheats must be enabled in your world, and you need the Game Directors permission level to use this command.
No, Bedrock Edition only accepts the file path argument, whereas passing extra arguments or data sources is only supported in Java Edition.
/dialogue/execute/packstack/reload/reloadpacketlimitconfig/schedule/scoreboard/scriptevent/sendshowstoreoffer/tag/testfor/testforblock/testforblocks/toggledownfall