# SoundService

Example usage:

```lua
-- Play a honk sound whenever an entity takes damage
Events.EntityDamage(function(event)
    local attackedPosition = event.entity:getPosition()
    SoundService.playSound(SoundType.VOICE_HONK, attackedPosition)
end)
```

### Functions

#### playSound(sound: [SoundType](/scripting/bedwars-scripting/types/soundtype.md), position: [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3) | nil)

Plays a sound globally. You can optionally specify where the sound will come from.

#### playSoundForPlayer(player: [Player](broken://pages/fOfVQF5nlALekCoylPz2), sound: [SoundType](/scripting/bedwars-scripting/types/soundtype.md), position: [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3) | nil)

Plays a sound for a specific player. You can optionally specify where the sound will come from.


---

# 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/soundservice.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.
