# ShapeClass.client_onInteract

Called when a [Player](../Game-Script-Environment/Userdata/Player.md) is interacting with the [Interactable](../Game-Script-Environment/Userdata/Interactable.md) by pressing the 'Use' key (default 'E') or pressing '0&ndash;9' if the [Interactable](../Game-Script-Environment/Userdata/Interactable.md) is connected to a seat. (See: [Interactable.pressSeatInteractable](../Game-Script-Environment/Userdata/Interactable.md#pressseatinteractable))

**Kind:** Callback

**Environments:** Game

## Game

**Callback side:** Client

``` { .lua .api-signature }
ShapeClass:client_onInteract( character, state )
```

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

> **Note:**
> If this method is defined, the player will see the interaction text "E Use" when looking at the [Shape](../Game-Script-Environment/Userdata/Shape.md).

```lua
-- Example of interaction
function MySwitch.client_onInteract( self, character, state ) 
	if state == true then
		self.network:sendToServer( 'sv_n_toggle' )
	end
end

function MySwitch.sv_n_toggle( self ) 
	-- Toggle on and off
	self.interactable.active = not self.interactable.active
end
```

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `self` | table | The class instance. |
| `character` | [Character](../Game-Script-Environment/Userdata/Character.md) | The [Character](../Game-Script-Environment/Userdata/Character.md) of the [Player](../Game-Script-Environment/Userdata/Player.md) that is interacting with the [Interactable](../Game-Script-Environment/Userdata/Interactable.md). |
| `state` | boolean | The interaction state. (true if pressed, false if released) |
