Trigger Arm Swing Animations for Players and Entities
The /swing command forces a player or entity to play an arm swing animation. You can choose whether they swing their mainhand or offhand, and in version 26.3 and later, you can also pick a specific swing animation and how long it lasts.
Map makers and server creators use this command to make mobs or NPCs look like they are attacking, interacting with blocks, or waving at players without needing direct player input.
/swing/swing <targets>/swing <targets> mainhand/swing <targets> mainhand <animation> [<duration>]/swing <targets> offhand/swing <targets> offhand <animation> [<duration>]/swing/swing <targets>/swing <targets> mainhand/swing <targets> mainhand <animation> [<duration>]/swing <targets> offhand/swing <targets> offhand <animation> [<duration>]| Argument | Type | What it means |
|---|---|---|
<targets> | target selector | Specifies who performs the swing using a player name, a UUID, or a target selector like @p, @a, @e, or @s. |
<animation> | swing animation | Specifies the swing animation to play on the target's arm. |
<duration> | time at least 1 | Sets how long the animation lasts using a time value of at least 1, such as 100 (ticks), 5s, or 2d. |
/swingMakes your own character perform a basic arm swing.
/swing @pMakes the nearest player perform the default swing animation.
/swing Steve mainhandForces the player named Steve to swing their mainhand.
/swing @a offhandMakes every player currently online swing their offhand at the same time.
/swing @s mainhandForces the entity executing the command to swing its mainhand.
/swing @e[type=zombie] offhandMakes all loaded zombies in the world swing their offhand.
Measured from the game files of every Java release from 1.13 to 26.3.
Minecraft Bedrock Edition does not have a /swing command, as this feature is exclusive to Java Edition starting in version 26.1.
The /swing command was first added to Minecraft Java Edition in version 26.1, and its syntax was expanded in version 26.3 to include animation and duration arguments.
Yes, you can specify either mainhand or offhand right after the target selector to choose which arm performs the swing.
No, Bedrock Edition does not have a command with this name, and it only works in Java Edition with operator permissions enabled.
/advancement/attribute/damage/defaultgamemode/effect/experience/gamemode/kill/ride/rotate/spawnpoint/spectate/spreadplayers/summon/teleport/tp