# createObject (Client)

> Creates an object that exists on this client only.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Objects
- **URL**: https://wiki.mymp.gg/en/createObject-client
- **Counterpart**: Also exists on the server, with its own implementation: [createObject (Server)](https://wiki.mymp.gg/en/createObject-server.md)

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `model` | `string` | The model's name, case-insensitive. |
| `x, y, z` | `float` | The position in the world. A `vec3` also works. |
| `rx, ry, rz` | `float` | The 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

```lua
local barrier = createObject("roadworkbarrier1", 2495.0, -1668.0, 13.0, 0, 0, 90)
setElementFrozen(barrier, true)
```

### Note

A model that is neither an object nor a weapon is refused with a debug warning, and the function returns `false`.

## See also

- [createObject (Server)](https://wiki.mymp.gg/en/createObject-server.md): Creates an object every player sees.
- [moveObject (Shared)](https://wiki.mymp.gg/en/moveObject.md): Moves an object smoothly to a position, turning it along the way.
- [setObjectScale (Shared)](https://wiki.mymp.gg/en/setObjectScale.md): Changes an object's size, evenly or along each axis.
- [destroyElement (Shared)](https://wiki.mymp.gg/en/destroyElement.md): Destroys an element and all of its children. Before it goes, each one fires onElementDestroy on the server or onClientElementDestroy on the client.
