# 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

| `boolean` | 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

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

#### Return

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

#### Code Samples

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

WorldRankService:SetDisplayEnabled(false)
```

## Events


---

# 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.overdare.com/development/api-reference/classes/worldrankservice.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.
