> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.soba.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# How to attach and detach objects from a player

> Create a dynamic object which attaches and detaches to make your game more interesting.

In a delivery game scenario, where you need to collect and move a box to a specific location to score, here's the easiest way to attach and detach an object from a player:

**1. Select your object**

> [accordion] The basics for all behaviors
>
> 1. Tap on the object to which you want to add a [behavior](https://wiki.soba.xyz/behavior-editor/managing-behaviors/behavior-object.md)
> 2. With the object selected, tap on the “Details” button to the left of your screen.
>
> ![](https://i.imgur.com/jMSZzP8.png)
>
> 3. In the Details panel, tap “Add Behavior”.

**2. Set your Trigger**

To attach the object when the player interacts with it, select the “Interaction” block and drag it into the behavior editor.

**3. Set Object Action**

In the “Object Action” section, drag the “Attach to Player” block below the trigger. Toggle the block and untick “Wait for completion”. Positive Y puts things above the player, positive Z in front of the player.

**4. Create a Delivery Event**

In the “Trigger” tab, choose the “With Player” Event Block and drag it into your canvas. Let's add an [effect](https://wiki.soba.xyz/behavior-editor/game-logic/particles.md) when the box is delivered. In "Effects", select "Add a Particle Effect". Toggle the block and choose the desired effect. Then, let’s cancel the movement of the block being attached to the player. Choose the block “Cancel Animation”. This will detach the object from the player upon delivery.

> [accordion] Behavior Image
>
> ![](https://i.imgur.com/6Au1ZDW.jpeg)

**5. Create a Delivery Area**

Choose an object where the object will be detached. Tap on the “Details” button.

**6. Trigger for the Delivery Area**

Choose the “Player Touches Object” Trigger block to trigger the action when the player reaches the delivery spot. In the “Miscellaneous” category, pick the “Plain Event” block. Toggle it and name it “Deliver” to match the variable created.

> [accordion] Behavior Image
>
> ![](https://i.imgur.com/lRYcdCP.jpeg)

**7. Playtest!**

After setting up the movements, test your game to see how the object behaves and make adjustments for the perfect effect.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.