# getElementComponentVisible (Client)

> Tells whether a vehicle's or object's component is visible.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Components and bones
- **URL**: https://wiki.mymp.gg/en/getElementComponentVisible

## Syntax

```lua
bool getElementComponentVisible(vehicle|object element, string component)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `vehicle\|object` | The vehicle or object. |
| `component` | `string` | The component's name, as `getElementComponents` lists it. |

## Returns

`true` if it is visible. `false` if it is hidden or the component does not exist.

## Example

```lua
bindKey("b", "down", function()
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if vehicle then
        local visible = getElementComponentVisible(vehicle, "bonnet_dummy")
        setElementComponentVisible(vehicle, "bonnet_dummy", not visible)
    end
end)
```

### Coming from MTA

The same as MTA's `getVehicleComponentVisible`, but it also works on objects.

## See also

- [setElementComponentVisible (Client)](https://wiki.mymp.gg/en/setElementComponentVisible.md): Shows or hides a vehicle's or object's component. The change applies on this client only.
- [getElementComponents (Client)](https://wiki.mymp.gg/en/getElementComponents.md): Lists a vehicle's or object's components: the named frames of its model.
