Trigger Custom Script Events With Commands
The /scriptevent command causes an event to fire within a script using a specified message ID and data payload. It allows you to pass custom information directly to the scripts running inside your world's installed behavior packs.
Creators and map makers use this command to connect scripting with any location where commands are used. This is helpful when you want a command block or player action to trigger custom logic defined in your add-on files.
/scriptevent <messageId: string> <message: message>Send script event message
| Argument | Type | What it means |
|---|---|---|
message | message | Data component of the message to send. This is custom and dependent on the kinds of behavior packs and content you may have installed within the world. Message may not exceed 2048 characters in length. |
messageId | string | Identifier of the message to send. This is custom and dependent on the kinds of behavior packs and content you may have installed within the world. |
/scriptevent custom:game start_roundSends a simple message telling a custom minigame script to start a new round.
/scriptevent mypack:reward diamond_swordPasses an item name to a reward script so it can process giving a diamond sword.
/scriptevent arena:spawn zombie_wave_3Triggers an arena behavior pack script to spawn the third wave of zombies.
/scriptevent quest:complete talk_to_villagerNotifies a quest tracking script that the objective involving a villager is finished.
/scriptevent teleport:hub 100 64 -250Sends a set of coordinates as the message payload to a custom teleportation handler.
/scriptevent shop:buy {"item":"golden_apple","cost":15}Passes a formatted text string containing an item and cost to a custom shop script.
Minecraft Java Edition does not have a /scriptevent command, as this feature is exclusive to the Bedrock Edition scripting system.
The message payload argument cannot exceed 2048 characters in length.
The command only fires an event that installed behavior packs can listen for, so nothing will happen if your world does not have an active script programmed to respond to that exact message ID and payload.
No, Java Edition has no command with this name; it is only available in Minecraft Bedrock Edition when cheats are enabled.
/dialogue/execute/function/packstack/reload/reloadpacketlimitconfig/schedule/scoreboard/sendshowstoreoffer/tag/testfor/testforblock/testforblocks/toggledownfall