# Usage

* **Buying or Renting a Detector**
  * An **NPC** (shop) spawns at `Config.Shop.coord`. Players approach and press **E** to open a menu (NUI).
  * They can buy (`Config.Price.buy`) or rent (`Config.Price.rent`) the detector for limited time.
* **Activating the Detector**
  * The script checks if they have the item (`Config.Item = "metal_detector"`).
  * On activation, the player’s movement keys can be restricted (`Config.DisableKeys`).
  * The battery level (from `Upgrades["max_battery"]`) or leftover rent time is considered.
* **Digging**
  * **Shovel required:** If the player attempts to dig but lacks the `shovel` item, an error notifies them.
  * The script spawns a chest object or animates a dig scenario for **`Config.digTime`** (ms).
  * On success, the script randomly picks from `Config.Rewards` (like gold, jewelry, etc.).
  * Each reward item can have a `score` that increases a player’s scoreboard rank.
* **Upgrading**
  * Players can buy upgrades: a bigger battery time, extended radius, or a “radar” feature that more accurately pinpoints items.
  * Some upgrades have multiple levels, each with a **price**; if the player can’t afford it, they get a “no\_money” notification.
* **Tasks & Scoreboard**
  * Achievements revolve around **time** using the detector or number of digs performed.
  * Once a task is complete, the script awards money or items (like pizza, icedtea).
  * The scoreboard ranks players by total `score` from collecting items.


---

# 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://risk-scripts.gitbook.io/risk-scripts/scripts/advanced-metal-detector-script/usage.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.
