Prop.onDestroyed ▲ 12

Available from Easy Red 2 2.1.1

Called when a part of the prop breaks down. The callback receives the part number, 1 for the first. It keeps working when a streamed building goes away and comes back.


Return value

Return TypeDescription
voidThis function doesn't return anything

Parameters

ParameterTypeDescription
1functionfunction(part): the part that broke down, 1 for the first.

Examples

The first hit brings the whole prop down

-- on a destructible building: as soon as a part breaks, every part goes
myself:onDestroyed(function(part)
    if not myself:isDestroyed() then
        myself:destroy()
    end
end)

Back to Scripting API