# Creating stashes with ox_inventory

> Create storage in ox_inventory: stashes.lua entries, RegisterStash with owner and groups, shared vs personal stashes, ox_target and temporary stashes.

Source: https://fam-tools.com/guides/ox-inventory-stashes · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** Add fixed stashes to `ox_inventory/data/stashes.lua` (name, label, slots, weight, owner, groups, coords, target). From your own resource, call `exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, coords)` on the server before anyone opens it, then open it on the client with `exports.ox_inventory:openInventory('stash', id)`. `owner = true` gives every player their own copy; `groups` restricts access; `CreateTemporaryStash` makes throw-away storage.

## Key points

- Register on the server, open on the client.
- `owner = true` = personal stash per player; `nil` = shared.
- `groups = { police = 0 }` restricts by job and grade.
- `coords` limits opening to nearby players.
- Weight is in grams.

Police lockers, gang safes, house storage and evidence rooms are all stashes: inventories that live somewhere in the world instead of on a player. ox_inventory gives you a data file for fixed stashes and an export for stashes your own scripts create.

## Fixed stashes in stashes.lua

*ox_inventory/data/stashes.lua*

```lua
{
    coords = vec3(452.3, -991.4, 30.7),
    target = {
        loc = vec3(451.25, -994.28, 30.69),
        length = 1.2, width = 5.6, heading = 0,
        minZ = 29.49, maxZ = 32.09,
        label = 'Open personal locker',
    },
    name = 'policelocker',
    label = 'Personal locker',
    owner = true,
    slots = 70,
    weight = 70000,
    groups = { police = 0 },
},
```

## Stashes from your own resource

*server.lua*

```lua
-- a shared gang safe
exports.ox_inventory:RegisterStash('ballas_safe', 'Ballas Safe', 50, 200000, nil, { ballas = 0 }, vec3(105.2, -1941.6, 20.8))

-- one stash per house, owned by the house owner
local function registerHouseStash(houseId, ownerIdentifier, coords)
    exports.ox_inventory:RegisterStash(('house_%s'):format(houseId), 'House storage', 40, 150000, ownerIdentifier, nil, coords)
end
```

*client.lua — open it (for example from ox_target)*

```lua
exports.ox_target:addSphereZone({
    coords = vec3(105.2, -1941.6, 20.8),
    radius = 1.0,
    options = {
        {
            name = 'ballas_safe',
            label = 'Open safe',
            icon = 'fa-solid fa-vault',
            groups = { ballas = 0 },
            onSelect = function()
                exports.ox_inventory:openInventory('stash', 'ballas_safe')
            end,
        },
    },
})
```

## The owner field

| owner | Result |
| --- | --- |
| `nil` | Shared — everyone allowed sees the same items |
| `true` | Personal — each player gets their own copy |
| A string (identifier) | Only that owner’s stash |

## Temporary stashes

*server.lua — loot crate*

```lua
local id = exports.ox_inventory:CreateTemporaryStash({
    label = 'Supply crate',
    slots = 10,
    maxWeight = 50000,
    items = {
        { 'bandage', 3 },
        { 'water', 2 },
    },
})

exports.ox_inventory:forceOpenInventory(source, 'stash', id)
```

Temporary stashes are not saved; use them for loot, drops from events and one-off containers.

## Access and security

- Always set `groups` or `owner` on anything valuable — the client can try to open any stash ID.
- Set `coords` so the stash only opens near its location.
- Log or limit what goes in with a `swapItems` hook — see [ox_inventory hooks](https://fam-tools.com/guides/ox-inventory-hooks).

## Questions

### How do I create a stash in ox_inventory?

Add it to `data/stashes.lua`, or call `exports.ox_inventory:RegisterStash(...)` on the server and open it on the client with `openInventory('stash', id)`.

### How do I make a personal stash?

Set `owner = true`; every player then has their own copy of that stash.

### How do I restrict a stash to police?

Set `groups = { police = 0 }` (or a higher minimum grade).

### Are temporary stashes saved?

No. `CreateTemporaryStash` inventories are for short-lived containers.

## Related

- https://fam-tools.com/guides/ox-inventory-hooks
- https://fam-tools.com/guides/ox-inventory-shops-config
- https://fam-tools.com/guides/ox-inventory-items-lua
- https://fam-tools.com/guides/ox-inventory-metadata
