# getElementData (Shared)

> Reads a value stored on an element.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/getElementData

## Syntax

```lua
any|false getElementData(element element, string key)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The element holding the data. |
| `key` | `string` | The data's key. Keys longer than 128 characters are cut, with a warning. |

## Returns

The value stored under the key, or `false` if there is nothing there.

## Example

```lua
local money = getElementData(localPlayer, "money") or 0
outputDebugString("You have $" .. money)
```

### Coming from MTA

There is no `inherit` argument: only the element's own data is read.

## See also

- [setElementData (Server)](https://wiki.mymp.gg/en/setElementData-server.md): Keeps a piece of data on an element and, depending on sync, sends it to the players.
- [setElementData (Client)](https://wiki.mymp.gg/en/setElementData-client.md): Keeps a piece of data on an element, on this client only.
- [getAllElementData (Shared)](https://wiki.mymp.gg/en/getAllElementData.md): Reads all of an element's data at once.
- [removeElementData (Shared)](https://wiki.mymp.gg/en/removeElementData.md): Deletes a piece of data kept on an element.
