---
title: Use haptic vibration
slug: world-sdk-guide/use-haptic-vibration
docTags: 
createdAt: 2024-09-02T08:34:13.136Z
---

This guide will show you how to implement haptic vibration in ZEPETOScrip based on the `Handheld.Vibrate` function provided by Unity.

:::hint{type="info"}
**📘 Handheld**
[https://docs.unity3d.com/ScriptReference/Handheld.html](https://docs.unity3d.com/ScriptReference/Handheld.html)
:::



## Write a script

1\) In the \[Project] panel, select the \[+] menu in the upper-left corner or select Assets > Create > ZEPETO > TypeScript.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-BUG5s73Gz1UIQkJ6DQuDo-20240904-102425.png)



2\) Name the added script HapticVibration, and write a sample script as shown below.

```typescript
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { Button } from 'UnityEngine.UI';
import { Handheld } from 'UnityEngine';
 
export default class HapticVibration extends ZepetoScriptBehaviour {
 
    public vibrationButton: Button;
 
    Start() {   
        this.vibrationButton.onClick.AddListener(() => {
            Handheld.Vibrate();
        });
    }
}
```



3\) Add a GameObject to the Scene and rename it HapticFeedback. Add the HapticVibration ZEPETOScript you created.
In the Hierachy window, drag & drop the Button UI to the Property shown in the ZEPETOScript Inspector window.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-Pl9LjTtra_SxObbA-s5sP-20240904-102424.png)



## Testing on mobile

1\) Run the example world with the QR mobile test.

2\) When you press the button connected to the script, your device will vibrate.

:::hint{type="info"}
**📘&#x20;**&#x50;lease refer to the following guide. \[[QR mobile test](docId\:fOIzLEQi0jtaN3SnBTWLi)]
:::

:::hint{type="danger"}
**❗️ Caution**
Please note that `Handheld.Vibrate` only works in the mobile environment.
:::

