Roblox UtilitiesDevlHub Roblox Documentation

Class

HapticService

NotCreatableServiceNotReplicatedDeprecated
Inherits
Instance › Object
Memory category
Instances

Provides haptic feedback to controllers and devices.

Deprecated. This service has been superseded by HapticEffect, a newer instance that supports multiple haptic effect types, looped effects, and customizable haptics.

HapticService allows scripts to query vibration support and set motor intensities on gamepad controllers, VR controllers, and mobile devices. Use IsVibrationSupported() and IsMotorSupported() to check device capabilities, then SetMotor() to drive a specific VibrationMotor on a given UserInputType. Motor output is scaled by the user's haptic intensity preference in their Roblox settings.

As this service is client-side only, it can only be used in a LocalScript, a ModuleScript required by a LocalScript, or a Script with RunContext set to RunContext.Client.

This service has been superseded by HapticEffect, which supports waveform-based effects, looping, spatial attenuation, and preset effect types. For new work, use HapticEffect instead.

Methods 4#

GetMotorReturns the current vibration value set to the specified UserInputType and VibrationMotor.
IsMotorSupportedReturns true if the specified motor is available to be used with the specified UserInputType.
IsVibrationSupportedReturns true if the specified UserInputType supports haptic feedback.
SetMotorSets the vibration intensity of the specified UserInputType and VibrationMotor.

GetMotor(inputType: UserInputType, vibrationMotor: VibrationMotor): Tuple#

Returns the current vibration value set to the specified UserInputType and VibrationMotor. This will not return anything if SetMotor() has not been called prior.

NameTypeDefaultDescription
inputTypeUserInputTypeThe specified UserInputType.
vibrationMotorVibrationMotorThe specified VibrationMotor.
Returns

IsMotorSupported(inputType: UserInputType, vibrationMotor: VibrationMotor): boolean#

Returns true if the specified motor is available to be used with the specified UserInputType.

NameTypeDefaultDescription
inputTypeUserInputTypeThe specific UserInputType being checked for VibrationMotor support.
vibrationMotorVibrationMotorThe specified VibrationMotor checked to see if it supports the specified UserInputType.
Returns
  • boolean — Boolean of true if the specified motor is available to be used with the specified UserInputType, false if not.

IsVibrationSupported(inputType: UserInputType): boolean#

Returns true if the specified UserInputType supports haptic feedback.

NameTypeDefaultDescription
inputTypeUserInputTypeThe specified UserInputType checked to see if it supports haptic feedback.
Returns
  • boolean — Boolean of true if the specified UserInputType supports haptic feedback.

SetMotor(inputType: UserInputType, vibrationMotor: VibrationMotor, vibrationValues: Tuple): ()#

Sets the vibration intensity of the specified inputType and vibrationMotor. Note that almost all usage cases specify UserInputType.Gamepad1 for inputType which is internally mapped to the device's respective hardware.

NameTypeDefaultDescription
inputTypeUserInputTypeThe specified UserInputType.
vibrationMotorVibrationMotorThe specified VibrationMotor.
vibrationValuesTupleHow intensely the motor should vibrate. Only uses the first value in the tuple, which should be a number.
Returns
  • ()

Inherited members#

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

ClassName, className

Events (1)

Changed