# ShopService

Example usage:

<pre class="language-lua"><code class="lang-lua"><strong>Events.MatchStart(function(event)
</strong>    -- Adds 1 Solar Panel to the shop that can be purchased for 3 Diamonds
    ShopService.addItem(ItemType.SOLAR_PANEL, 1, ItemType.DIAMOND, 3)
    -- Adds 1 Tennis Racket to the shop that can be purchased for 15 Iron
    ShopService.addItem(ItemType.TENNIS_RACKET, 1, ItemType.IRON, 15)
end)
</code></pre>

### Functions

**getAllShopkeeperIds(): string\[]**

Returns all current shopkeepers (by ID) in the game.

**spawnShopkeeper(shopType:** "items" **|** "upgrade"**, position:** [**Vector3**](https://create.roblox.com/docs/reference/engine/datatypes/Vector3)**): string**

Creates an item shopkeeper or upgrade shopkeeper at the given position. Returns the ID (string) of the created shop.

**despawnShopkeeper(shopId: string)**

Deletes the shopkeeper with the given ID (string).

#### addItem(item: [ItemType](/scripting/bedwars-scripting/types/itemtype.md), amount: number, costItem: [ItemType](/scripting/bedwars-scripting/types/itemtype.md), price: number)

Adds an item to the shop for all players.

* amount - The amount of the item received when purchased
* costItem - The type of item needed to purchase the specified item
* price - The amount of the cost item needed to purchase the specified item

#### removeItem(item: [ItemType](/scripting/bedwars-scripting/types/itemtype.md))

Removes the item from the shop for all players.


---

# 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://docs.easy.gg/scripting/bedwars-scripting/services/shopservice.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.
