<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [server](./server.md) &gt; [Entity](./server.entity.md) &gt; [interact](./server.entity.interact.md)

## Entity.interact() method

Triggers an interaction on the entity from a player.

Use for: programmatic interactions that should mimic a player click/tap. Do NOT use for: server-only effects without player context.

**Signature:**

```typescript
interact(player: Player, raycastHit?: RaycastHit): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

player


</td><td>

[Player](./server.player.md)


</td><td>

The player interacting with the entity.


</td></tr>
<tr><td>

raycastHit


</td><td>

[RaycastHit](./server.raycasthit.md)


</td><td>

_(Optional)_ The raycast hit result, if the interaction was triggered by a client-side click/tap.

\*\*Requires:\*\* Entity must be spawned.

\*\*Side effects:\*\* Emits `EntityEvent.INTERACT`<!-- -->.

\*\*Category:\*\* Entities


</td></tr>
</tbody></table>
**Returns:**

void

## Remarks

This is automatically called when a player clicks or taps the entity, but can also be called directly for programmatic interactions. Emits `EntityEvent.INTERACT`<!-- -->.

