setElementParent
Shared
Makes an element a child of another in the element tree.
bool setElementParent(element element, element parent)
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | The element to move. |
| parent | element | The new parent. |
Returns
true if it changed, false if the element is a system one (such as root), came from the server (on a client), or the new parent is the element itself or one of its descendants.
Example
local group = createElement("race-group")
local car = createVehicle("infernus", 2495, -1687, 13.5)
setElementParent(car, group)
destroyElement(group)