M MY Multiplayer: Wiki
Side
Kind

detachElements

Shared

Detaches an element from the element it hangs on. It stays where it is.

bool detachElements(element element [, element target = nil])

Parameters

NameTypeDescription
elementelementThe element to detach.
targetelementIf given, the element is only detached when it hangs on this target.default nil

Returns

true if it was detached. false if the element was not attached, if target was given and is not its current target, or if onElementDetach was cancelled.

Example

addCommandHandler("soltar", function(player)
    local target = getElementAttachedTo(player)
    if target then
        detachElements(player, target)
    end
end)

See also