M MY Multiplayer: Wiki
Side
Kind

createObject

Client

Creates an object that exists on this client only.

Also exists on the server, with its own implementation: createObject

object|false createObject(string model, float x, y, z [, float rx, ry, rz = 0, 0, 0])

Parameters

NameTypeDescription
modelstringThe model's name, case-insensitive.
x, y, zfloatThe position in the world. A vec3 also works.
rx, ry, rzfloatThe rotation in degrees. A vec3 also works.default 0, 0, 0

Returns

The created object, or false if it could not be created.

The object goes away when the resource that created it stops.

Example

local barrier = createObject("roadworkbarrier1", 2495.0, -1668.0, 13.0, 0, 0, 90)
setElementFrozen(barrier, true)
NoteA model that is neither an object nor a weapon is refused with a debug warning, and the function returns false.

See also