ProjectileHit

Fires when a launched projectile hits something (such as a block or entity)

Example usage:

Events.ProjectileHit(function(event)
    -- Only continue if the projectile that hit was Whim's nature spell
    if (event.projectileType == "mage_spell_nature") then
        local blockAt = BlockService.getBlockAt(event.position)
        if (blockAt.blockType == ItemType.DIRT) then
            BlockService.placeBlock(ItemType.GRASS, event.position)
            ModelService.createModel(ModelType.DAISY, blockAt.position + Vector3.new(0,2.5,0))
        end
    end
end)

Parameters

shooter: Entity | nil

The entity that launched the projectile (may not exist).

projectileType: ProjectileType

The type of projectile that hit.

position: Vector3

The position that the projectile hit.

hitEntity: Entity | nil

The entity that was hit by the projectile (may not exist).

cancelled: bool [modifiable]

If set to true, the projectile hit will be cancelled.

Last updated