# WorldRankService

WorldRankService : `Instance`

## Overview

WorldRankService is a service provided for players to save the score acquired from world in the form of a leaderboard and retrieve it.

Key features such as score increase (Increment) and score retrieval (GetScore) induce competition among players and allow an easy implementation of rank-based content both in-game and out-game.

Uploaded scores are automatically sorted in descending order in backend; the result is displayed in the Top Scorer section on top of the world detail screen that is displayed before entering into world.

This service works only on server environment; it cannot be called from client script.

## Properties

## Methods

### GetDisplayEnabled

Returns whether the ranking and score are set to be displayed above the character.

#### Parameters

#### Return

| `bool` | Specifies whether or not to display the ranking and score. |
| ------ | ---------------------------------------------------------- |

#### Code Samples

```lua
local WorldRankService = game:GetService("WorldRankService")

local Enabled = WorldRankService:GetDisplayEnabled()
```

### GetScore

Returns the current score of the player listed on the leaderboard.

#### Parameters

| `Player` Player | The player who is to check current score. |
| --------------- | ----------------------------------------- |

#### Return

| `number` | The returned score. |
| -------- | ------------------- |

#### Code Samples

```lua
local WorldRankService = game:GetService("WorldRankService")

local Score = WorldRankService:GetScore(player)
```

### IncrementScore

Uploads the score variance of a specified player to the leaderboard. Score must be an integer, and variance must be a positive number. The maximum allowed variance is 100,000. Any request with a variance exceeding this limit will not be processed.

#### Parameters

| `Player` Player | The player whose score is to be uploaded. |
| --------------- | ----------------------------------------- |
| `number` Score  | The score variance.                       |

#### Return

| `void` |   |
| ------ | - |

#### Code Samples

```lua
local WorldRankService = game:GetService("WorldRankService")

local score = 1
WorldRankService:IncrementScore(player, score)
```

### SetDisplayEnabled

Sets whether the ranking and score are displayed above character.

#### Parameters

| `bool` Enabled | Specifies whether or not to display the ranking and score. |
| -------------- | ---------------------------------------------------------- |

#### Return

| `void` |   |
| ------ | - |

#### Code Samples

```lua
local WorldRankService = game:GetService("WorldRankService")

WorldRankService:SetDisplayEnabled(false)
```

## Events
