Reference API Roblox

Engine API

Website

Related

Reference API Roblox

HapticEffect

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

Member index 9

HistoryMember
731Looped: bool
731Position: Vector3
731Radius: float
731Type: HapticEffectType
638Play(): null
655SetWaveformKeys(keys: Array): null
638Stop(): null
692Ended()
inherited from Instance
731Archivable: bool
731Capabilities: SecurityCapabilities
731IsInSandbox: bool
731Name: string
731Parent: Instance
731PredictionMode: PredictionMode
731Sandboxed: bool
731UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
731children(): Instances
731clone(): Instance
731destroy(): null
731findFirstChild(name: string, recursive: bool = false): Instance
731getChildren(): Instances
731isDescendantOf(ancestor: Instance): bool
731remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
731childAdded(child: Instance)
inherited from Object
731ClassName: string
731className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
731isA(className: string): bool
647Changed(property: string)

Removed member index 2

HistoryMember
719Waveform: FloatCurve
655SetKeys(keys: Array): null

Description

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

History 31

Members 9

Ended

Parameters (0)
No parameters.

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.

History 1

Looped

TypeDefault
boolfalse

Whether the haptic effect loops continuously.

History 3

Play

Parameters (0)
No parameters.
Returns (1)
null

Plays the haptic effect.

History 1

Position

TypeDefault
Vector30, 0, 0

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.

History 5

Radius

TypeDefault
float3

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.

History 5

  • 731 Change Default of Radius from to 3
  • 726 Change Default of Radius from 3 to
  • 655 Change WriteSecurity of Radius from RobloxScriptSecurity to None
  • 655 Change ReadSecurity of Radius from RobloxScriptSecurity to None
  • 638 Add Radius

SetWaveformKeys

Parameters (1)
keysArray
Returns (1)
null

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.

History 1

Stop

Parameters (0)
No parameters.
Returns (1)
null

Stops the haptic effect.

History 1

Type

TypeDefault
HapticEffectTypeUIClick

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().

History 3

Removed members 2

SetKeys

Parameters (1)
keysArray
Returns (1)
null

History 2

Waveform

TypeDefault
FloatCurve
This property is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 3

Tags: [Deprecated]

Settings