Prop.onDestroyed 12
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 Type | Description |
|---|---|
| void | This function doesn't return anything |
Parameters
| Parameter | Type | Description |
|---|---|---|
| 1 | function | function(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)