> For the complete documentation index, see [llms.txt](https://docs.easy.gg/scripting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.easy.gg/scripting/bedwars-scripting/services/abilityservice.md).

# AbilityService

Example usage:

```lua
AbilityService.createAbility("script_speed", "MiscPrimary", {
    maxProgress = 10,
    progressPerUse = 5,
})

AbilityService.enableAbility(MatchService.getHost(), "script_speed")

Events.UseAbility(function (event)
    if (event.abilityName == "script_speed") then
        StatusEffectService.giveEffect(event.entity, StatusEffectType.SPEED, 2)
    end
end)
```

### Functions

#### createAbility(abilityName: string, abilityInputType: [AbilityInputType](/scripting/bedwars-scripting/types/abilityinputtype.md), config: [AbilityConfig](/scripting/bedwars-scripting/objects/abilityconfig.md))

Creates a new custom ability that can be enabled for players.

#### enableAbility(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string, progressRate: number | nil)

Enables the custom ability for the player. Use the optional progressRate parameter to set the rate (in seconds) at which progress is restored to the custom ability.

#### removeAbility(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string)

Removes the custom ability from the player.

#### setProgressRate(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string, progressRate: number | nil)

Sets the rate (in seconds) at which progress is restored to the cstom ability.

#### getProgress(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string): number

Returns the current progress of the ability.

#### addProgress(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string, amount: number)

Adds the given amount of progress to the current progress on the ability.

#### subProgress(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string, amount: number)

Subtracts the given amount of progress from the current progress on the ability.

#### setProgress(player: [Player](/scripting/bedwars-scripting/objects/player.md), abilityName: string, amount: number)

Sets the progress for the ability to the given amount.

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

Returns a list of custom abilities that the player currently has enabled.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.easy.gg/scripting/bedwars-scripting/services/abilityservice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
