# Auxvyn.set()

### Syntax

```lua
Auxvyn.set(userId: number | string, key: string, value: any): boolean
```

***

### Parameters

| Parameter | Type             | Required   | Description                 |
| --------- | ---------------- | ---------- | --------------------------- |
| `userId`  | number or string | <h3>✓</h3> | The player's Roblox user ID |
| `key`     | string           | <h3>✓</h3> | The key to set              |
| `value`   | any              | <h3>✓</h3> | The value to store          |

***

### Returns

`true` if the value was saved successfully, `false` if it failed.

***

### Example

```lua
local success = Auxvyn.set(player.UserId, "coins", 500)

if success then
    print("Saved successfully")
else
    warn("Failed to save — retrying or handling error")
end
```

***

### Supported Value Types

| Type    | Example               |
| ------- | --------------------- |
| Number  | `500`                 |
| String  | `"warrior"`           |
| Boolean | `true`                |
| Table   | `{"sword", "shield"}` |

> Roblox-specific types like `Vector3`, `CFrame`, or `Color3` cannot be stored directly. Convert them first:
>
> ```lua
> -- Store a Vector3 as a table
> Auxvyn.set(player.UserId, "position", {
>     x = pos.X,
>     y = pos.Y,
>     z = pos.Z
> })
> ```

***

### Overwriting Values

Calling `set()` on an existing key replaces the value entirely. To update part of a table, read it first, modify it, then write it back:

```lua
local inventory = Auxvyn.get(player.UserId, "inventory") or {}
table.insert(inventory, "sword")
Auxvyn.set(player.UserId, "inventory", inventory)
```

***

### What's Next


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://auxvyn.gitbook.io/auxvyn-docs/module/auxvyn.set.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
