# ShapeClass.client_getAvailableParentConnectionCount

Called to check how many more parent (input) connections with the given type [flag](../Game-Script-Environment/Static-Functions/sm.interactable.md#connectiontype) the [Interactable](../Game-Script-Environment/Userdata/Interactable.md) will accept. Return 1 or more to allow a connection of this type.

**Kind:** Callback

**Environments:** Game

## Game

**Callback side:** Client

``` { .lua .api-signature }
ShapeClass:client_getAvailableParentConnectionCount( flags )
```

[Open the full Game reference](../Game-Script-Environment/Classes/ShapeClass.md#client_getavailableparentconnectioncount)

```lua
-- Example of implementation where logic and power shares the same slot but electricity counts as separate
MyIteractable.maxParentCount = 2
MyIteractable.connectionInput = sm.interactable.connectionType.logic + sm.interactable.connectionType.power + sm.interactable.connectionType.electricity

function MyIteractable.client_getAvailableParentConnectionCount( self, flags )
	if bit.band( flags, bit.bor( sm.interactable.connectionType.logic, sm.interactable.connectionType.power ) ) ~= 0 then
		return 1 - self:getParents( bit.bor( sm.interactable.connectionType.logic, sm.interactable.connectionType.power ) )
	end
	if bit.band( flags, sm.interactable.connectionType.electricity ) ~= 0 then
		return 1 - self:getParents( sm.interactable.connectionType.electricity )
	end
	return 0
end
```

> **Note:**
> [maxParentCount](../Game-Script-Environment/Classes/ShapeClass.md#maxparentcount) must be 1 or more for this callback to be called.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `self` | table | The class instance. |
| `flags` | integer | Connection type flags. |

**Returns:**

| Type | Description |
| --- | --- |
| integer | The number of available connections. |
