M MY Multiplayer: Wiki
Side
Kind

onElementModelChange

ServerEventCancellable

Fired after setElementModel changes an element's model. Cancelling the event puts the previous model back, and setElementModel returns false.

addEventHandler("onElementModelChange", root, function(string oldModel, string newModel) … end)

Handler parameters

NameTypeDescription
oldModelstringThe previous model's name.
newModelstringThe new model's name.

Source

The element whose model changed.

Example

local allowed = { male01 = true, wmybar = true, bfori = true }

addEventHandler("onElementModelChange", root, function(oldModel, newModel)
    if getElementType(source) == "player" and not allowed[newModel] then
        cancelEvent()
    end
end)

See also