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
| Name | Type | Description |
|---|---|---|
| oldModel | string | The previous model's name. |
| newModel | string | The 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)