# getElementsByType (Client)

> Lists every element of a type below an element of the tree on this client.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/getElementsByType-client
- **Counterpart**: Also exists on the server, with its own implementation: [getElementsByType (Server)](https://wiki.mymp.gg/en/getElementsByType-server.md)

## Syntax

```lua
table getElementsByType(string type [, element startAt = root, bool streamedIn = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `type` | `string` | The type to look for, such as `"vehicle"` or a type from `createElement`. |
| `startAt` | `element` | The element the search goes down from. *(default: `root`)* |
| `streamedIn` | `bool` | With `true`, leaves out the elements that are not loaded in this client's world. *(default: `false`)* |

## Returns

A table with the elements, empty if there are none.

## Example

```lua
for _, ped in ipairs(getElementsByType("ped", root, true)) do
    setElementCastShadow(ped, false)
end
```

## See also

- [getElementsByType (Server)](https://wiki.mymp.gg/en/getElementsByType-server.md): Lists every element of a type below an element of the tree on the server.
- [getElementChildren (Shared)](https://wiki.mymp.gg/en/getElementChildren.md): Lists an element's direct children, optionally only those of one type.
- [isElementStreamedIn (Client)](https://wiki.mymp.gg/en/isElementStreamedIn.md): Tells whether an element is loaded into this client's world.
