Comment on page

WeaponSwing

Fires when a weapon swings.
Example usage:
Events.WeaponSwing(function(event)
if (event.weapon == ItemType.LASER_SWORD) then
ItemService.dropItem(ItemType.COSMIC_LUCKY_BLOCK, event.player:getEntity():getPosition())
end
end)

Parameters

player: Player​

The player that is swinging the weapon.

weapon: ItemType​

The ItemType of the weapon being swung.

hitEntity: Entity | nil

The entity that was hit by the sword swing (may not exist if the swing missed).

cancelled: bool [modifiable]

If set to true, the weapon swing will be cancelled.
​