> For the complete documentation index, see [llms.txt](https://docs.overdare.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overdare.com/development/api-reference/classes/serviceprovider.md).

# ServiceProvider

ServiceProvider : `Instance`

## Overview

An abstract base class that returns service Objects such as Workspace or Players

## Properties

## Methods

### FindService

If a service with the specified name exists, it returns that service.

If the name is incorrect or the service hasn't been created yet, an error will occur.

#### Parameters

| `string` InClassName | The class name of the service to retrieve. |
| -------------------- | ------------------------------------------ |

#### Return

| `Instance` | The requested service instance. |
| ---------- | ------------------------------- |

#### Code Samples

```lua
local Workspace = game:FindService("Workspace")
local InvalidService = game:FindService("InvalidService")
```

### GetService

If a service with the specified name exists, it returns that service.

If the provided name corresponds to a valid service, it returns the service if it already exists; if not, the service is automatically created and returned.

#### Parameters

| `string` InClassName | The class name of the service to retrieve. |
| -------------------- | ------------------------------------------ |

#### Return

| `Instance` | The requested service instance. |
| ---------- | ------------------------------- |

#### Code Samples

```lua
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
```

## Events

## See also

{% content-ref url="/pages/2QyvZhqC78UF4i0Nhcpr" %}
[Object Reference](/manual/script-manual/get-started/object-reference.md)
{% endcontent-ref %}
