# getResourceState (Shared)

> Tells which state a resource is in.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Resources and modules
- **URL**: https://wiki.mymp.gg/en/getResourceState

## Syntax

```lua
string|false getResourceState(resource|string resource)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `resource` | `resource\|string` | The resource, or its name. |

## Returns

`"loaded"` (stopped), `"starting"`, `"running"` or `"stopping"`, or `false` if the resource does not exist.

## Example

```lua
if getResourceState("scoreboard") == "loaded" then
    startResource("scoreboard")
end
```

### Note

A stopped resource can only be given by name, since it has no element.

## See also

- [startResource (Shared)](https://wiki.mymp.gg/en/startResource.md): Starts a resource right away, after starting the resources it includes with <include> in its meta.xml.
- [stopResource (Shared)](https://wiki.mymp.gg/en/stopResource.md): Asks to stop a running resource. It stops on the next resource pulse, not during the call.
- [getResourceFromName (Shared)](https://wiki.mymp.gg/en/getResourceFromName.md): Finds a resource by name.
