# MatchService

### Functions

#### getHost(): [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/player)

Returns the Player that is currently hosting the match.

**getPlayerRole(player:** [**Player**](https://docs.easy.gg/scripting/bedwars-scripting/objects/player)**):** [**MatchRole**](https://docs.easy.gg/scripting/bedwars-scripting/types/matchrole) **| nil**

Returns the MatchRole of a player if it exists.

#### getMatchDurationSec(): number

Returns amount of time in seconds since the match started (returns 0 if still in pre-game).

#### getMatchState(): [MatchState](https://docs.easy.gg/scripting/bedwars-scripting/services/broken-reference)

Returns current match state.

#### endMatch(winningTeam: [Team](https://docs.easy.gg/scripting/bedwars-scripting/services/broken-reference) | nil)

Ends the match with a specified winning team (or nil to cause a tie game).
