# HapticEffect

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/HapticEffect/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/HapticEffect

An object that provides waveform-based haptic feedback (vibrations and rumbles) on supported controllers and mobile devices.

## Properties

### Looped

```luau
HapticEffect.Looped: boolean = false
```

- Tags: Capabilities: Input

Whether the haptic effect loops continuously.

### Position

```luau
HapticEffect.Position: Vector3 = Vector3.zero
```

- Tags: Capabilities: Input

Along with [`Radius`](https://rapi.sleaze.dev/classes/HapticEffect.md), specifies the impact position relative to the input device and, effectively, how broadly that impact effects nearby motors.

### Radius

```luau
HapticEffect.Radius: number = 3
```

- Tags: Capabilities: Input

Along with [`Position`](https://rapi.sleaze.dev/classes/HapticEffect.md), specifies the impact radius relative to the input device and, effectively, how broadly that impact effects nearby motors.

### Type

```luau
HapticEffect.Type: Enum.HapticEffectType = Enum.HapticEffectType.UIClick
```

- Tags: Capabilities: Input

`HapticEffectType` describing the haptic type.

### WaveformData

```luau
HapticEffect.WaveformData: string = ""
```

- Tags: Hidden, Not scriptable, Roblox engine security, Read capabilities: Input

## Methods

### Play

```luau
HapticEffect:Play()
```

- Tags: Capabilities: Input

Plays the haptic effect.

### SetWaveformKeys

```luau
HapticEffect:SetWaveformKeys(keys: { any })
```

- Tags: Capabilities: Input

Defines a custom waveform as a table and applies it to the haptic.

```luau
This method takes in an array of `FloatCurveKey` objects.
```

Parameters:

- `keys`: An array of [`FloatCurveKey`](https://rapi.sleaze.dev/index/types/FloatCurveKey.md) objects defining the custom haptic waveform, where each key specifies a time in milliseconds, an intensity value from 0 (no haptic) to 1 (full intensity), and an `KeyInterpolationMode` for interpolation between keys.

### Stop

```luau
HapticEffect:Stop()
```

- Tags: Capabilities: Input

Stops the haptic effect.

## Events

### Ended

```luau
HapticEffect.Ended: RBXScriptSignal<()>
```

- Tags: Capabilities: Input

Fires when the [`HapticEffect`](https://rapi.sleaze.dev/classes/HapticEffect.md) has completed playback and stopped.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
