BlockPlace

Fires when a Player places a block

-- Fortify all blocks placed by players to Stone Brick
Events.BlockPlace(function(event)
    -- Only fortify player blocks
    if (not event.player) then
        return
    end
    -- Only replace wool blocks
    if not string.includes(event.blockType, "wool") then
        return
    end
    
    
    BlockService.placeBlock(ItemType.STONE_BRICK, event.position)
    SoundService.playSound(Sound.FORTIFY_BLOCK, event.position)
    event.cancelled = true
end)

Parameters

player: Player | nil

Player placing the block (if placed by a player).

position: Vector3

Position in the world the block is being placed at.

blockType: ItemType

The type of the block being placed

cancelled: bool [modifiable]

If set to true, the block place will be denied.

Last updated