# Run an Immediate Interaction in a State Tree

> For the complete documentation index, see [llms.txt](llms.txt).

Make a switch toggle a light as soon as the player presses Use. Start with a [source and target that can focus each other](int-first-steps.html). This same tree can run after a Hold action confirms or after a proximity pickup is selected.

Procedure: Give the switch a one-step tree

1. Duplicate `ST_Interaction_Generic` into your game folder or create a State Tree with the Interaction schema. Add or keep the Interaction State evaluator.

2. Make Use Switch the first active state and add Trigger Target Behavior. Bind Target Actor and Smart Object Claim Handle from Interaction State. Keep Release Handle Automatically on for this short action. On state success, finish the tree successfully. On failure, finish as failed.

3. Assign this tree to the switch slot's Execute Interaction configuration. Use `Interaction.Type.Interact` for both the type and the slot's runtime tag. Set Duration to `0`. The first state should go straight to the behavior, with no wait, movement, or montage.

4. Keep the base actor's immediate Finished result from Start Interaction. On its target component's On Interaction Finished, toggle the light once. For a shared light in multiplayer, change its state on the server and replicate the result.

## Try It in Play

Focus the switch and press once. The light should change immediately. Keep holding the key and check that the light changes only once per press. Release and press again to switch it back. If it toggles twice, check that the input sends one request and that only one finish handler toggles the light.

