# TeamUpgradePurchased

{% hint style="warning" %}
This event was changed following the Season 10 update (April 5th, 2024)

The types used for the`upgrade`property were **changed**. Please refer to [TeamUpgradeType](/scripting/bedwars-scripting/types/teamupgradetype.md) for the new Team Upgrades that can be referenced in this event.

The `tier` property has been removed as all tiers of Team Upgrades are now accessible directly through their name, using the `upgrade` property (`MAGIC_I` and `MAGIC_II`, for example)
{% endhint %}

Example usage:

```lua
Events.TeamUpgradePurchased(function(event)
    -- Only proceed if the MAGIC I upgrade was purchased
    if (event.upgrade == TeamUpgradeType.MAGIC_I) then
       local teamPlayers = event.team:getInGamePlayers()
       -- Loop over all players in the team that received the upgrade
        for i, player in pairs(teamPlayers) do
           -- Give each team player 5 telepearls
           InventoryService.giveItem(player, ItemType.TELEPEARL, 5)
        end
    end
end)
```

### Parameters

#### player: [Player](/scripting/bedwars-scripting/objects/player.md)

The player who purchased the team upgrade.

#### team: [Team](/scripting/bedwars-scripting/objects/team.md)

The team that received the team upgrade.

#### upgrade: [TeamUpgradeType](/scripting/bedwars-scripting/types/teamupgradetype.md)

The team upgrade that was purchased by the player.


---

# 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/events/teamupgradepurchased.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.
