M MY Multiplayer: Wiki
Side
Kind

onClientElementDetach

ClientEventCancellable

Fired before an element is detached by a client script, by detachElements or by attachElements moving it to another target. Cancelling the event keeps the element attached.

addEventHandler("onClientElementDetach", root, function(element detachedFrom, float x, y, z, float rx, ry, rz) … end)

Handler parameters

NameTypeDescription
detachedFromelementThe element it hangs on.
x, y, zfloatThe element's world position at that moment.
rx, ry, rzfloatThe element's rotation at that moment.

Source

The element about to be detached.

When the target is destroyed, the elements hanging on it are detached without firing this event. If the event is cancelled during an attachElements to another target, that attachElements returns false.

Example

addEventHandler("onClientElementDetach", root, function(detachedFrom, x, y, z)
    outputDebugString(("%s detached at %.1f, %.1f, %.1f"):format(getElementType(source), x, y, z))
end)

See also