Roblox UtilitiesDevlHub Roblox Documentation

Class

HapticEffect

Inherits
Instance › Object
Memory category
Instances

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

Modern controllers and devices have motors built‑in to provide haptic feedback. Adding rumbles and vibrations can provide subtle feedback that is hard to convey through visuals or audio.

Roblox supports haptics for the following devices:

  • Android and iOS phones supporting haptics including most iPhone, Pixel, and Samsung Galaxy devices
  • PlayStation gamepads
  • Xbox gamepads
  • Quest Touch controller

Properties 4#

LoopedbooleanWhether the haptic effect loops continuously.ReadSafe
PositionVector3Along with Radius, specifies the impact position relative to the input device and, effectively, how broadly that impact effects nearby motors.ReadSafe
RadiusfloatAlong with Position, specifies the impact radius relative to the input device and, effectively, how broadly that impact effects nearby motors.ReadSafe
TypeHapticEffectTypeHapticEffectType describing the haptic type.ReadSafe

Looped: boolean#

ReadSafe

Whether the haptic effect loops continuously.

Position: Vector3#

ReadSafe

Along with Radius, specifies the impact position relative to the input device and, effectively, how broadly that impact effects nearby motors. Note that some gamepads do not have both "small" and "large" motors, and that "gamepad large left/right" is not supported on PC.

Radius: float#

ReadSafe

Along with Position, specifies the impact radius relative to the input device and, effectively, how broadly that impact effects nearby motors. Note that some gamepads do not have both "small" and "large" motors, and that "gamepad large left/right" is not supported on PC.

Type: HapticEffectType#

ReadSafe

The haptic type, such as HapticEffectType.GameplayCollision for a large immediate rumble that dies down quickly. The HapticEffectType.Custom value lets you specify a haptic with custom waveform keys defined through SetWaveformKeys().

Methods 3#

PlayPlays the haptic effect.
SetWaveformKeysDefines a custom waveform as a table and applies it to the haptic.

This method takes in an array of FloatCurveKey objects.

StopStops the haptic effect.

Play(): ()#

Plays the haptic effect.

Returns
  • ()

SetWaveformKeys(keys: Array): ()#

This method lets you define a custom waveform as a table and apply it to the haptic. It takes an array of FloatCurveKey objects, each constructed with three arguments: time in milliseconds, value ranging from 0 (no haptic) to 1 (full intensity), and an KeyInterpolationMode that controls how the curve interpolates. between keys.

NameTypeDefaultDescription
keysArrayAn array of FloatCurveKey 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.
Returns
  • ()

Stop(): ()#

Stops the haptic effect.

Returns
  • ()

Events 1#

EndedFires when the HapticEffect has completed playback and stopped.

Ended()#

Fires when the HapticEffect has completed playback and stopped. Note this event will not fire for haptics with Looped set to true since they continue playing upon reaching the end. This event will also not fire when the haptic is stopped before playback has completed.

This event is often used to destroy an HapticEffect when it has completed playback.

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed