> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markz3d.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PlaceSafe

Creates a new safe and saves it to the database.

<table>
  <thead>
    <tr>
      <th scope="col">
        Argument
      </th>

      <th scope="col">
        Data Type
      </th>

      <th scope="col">
        Needed
      </th>

      <th scope="col">
        Default
      </th>

      <th scope="col">
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <th>`safe_id`</th>
      <td>string</td>
      <td>❌</td>
      <td>`nil`</td>
      <td>The unique id of the safe, if `nil` a new one is generated</td>
    </tr>

    <tr>
      <th>`model`</th>
      <td>string</td>
      <td>✅</td>
      <td>`-`</td>
      <td>The safe model (key) defined in `Config.Safes`</td>
    </tr>

    <tr>
      <th>`coords`</th>
      <td>vector3</td>
      <td>✅</td>
      <td>`-`</td>
      <td>The coordinates where the safe will be placed</td>
    </tr>

    <tr>
      <th>`rotation`</th>
      <td>vector3</td>
      <td>✅</td>
      <td>`-`</td>
      <td>The rotation of the safe</td>
    </tr>

    <tr>
      <th>`options`</th>
      <td>table</td>
      <td>❌</td>
      <td>`nil`</td>
      <td>Overrides the safe inventory (`label`, `slots`, `weight`), if `nil` the inventory defined in `Config.Safes` is used</td>
    </tr>
  </tbody>
</table>

> **Returns**
>
> <table>
>   <thead>
>     <tr>
>       <th scope="col">
>         Type
>       </th>
>
>       <th scope="col">
>         Description
>       </th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>boolean</td>
>
>       <td>
>         true if the safe has been created, false otherwise
>       </td>
>     </tr>
>
>     <tr>
>       <td>string</td>
>
>       <td>
>         The id of the created safe, or the error message if the safe has not been created (`Invalid safe data` if the model does not exist or the id is not a string, `Safe already exists` if a safe with that id already exists)
>       </td>
>     </tr>
>   </tbody>
> </table>

> **Example**
>
> ```lua theme={null}
> local success, safeId = exports["mxc_safe"]:PlaceSafe(nil, "mxc_safe_prop_base_01", vector3(100.0, 100.0, 30.0), vector3(0.0, 0.0, 90.0))
>
> if success then
>     print("Safe created with id", safeId)
> end
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.