HapticService
Provides haptic feedback to controllers and devices.
| Memory category | Instances |
|---|
Member index 4
Description
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.
History 10
- 573 Change ReturnType of SetMotor from void to null
- 462 Change ThreadSafety of SetMotor from to Unsafe
- 462 Change ThreadSafety of IsVibrationSupported from to Unsafe
- 462 Change ThreadSafety of IsMotorSupported from to Unsafe
- 462 Change ThreadSafety of GetMotor from to Unsafe
- 232 Add SetMotor
- 232 Add IsVibrationSupported
- 232 Add IsMotorSupported
- 232 Add GetMotor
- 232 Add HapticService
Members 4
GetMotor
| Parameters (2) | ||
|---|---|---|
| inputType | UserInputType | |
| vibrationMotor | VibrationMotor | |
| Returns (1) | ||
| 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.
| Thread safety | Unsafe |
|---|
IsMotorSupported
| Parameters (2) | ||
|---|---|---|
| inputType | UserInputType | |
| vibrationMotor | VibrationMotor | |
| Returns (1) | ||
| bool | ||
Returns true if the specified motor is available to be used with the
specified UserInputType.
| Thread safety | Unsafe |
|---|
History 2
- 462 Change ThreadSafety of IsMotorSupported from to Unsafe
- 232 Add IsMotorSupported
IsVibrationSupported
| Parameters (1) | ||
|---|---|---|
| inputType | UserInputType | |
| Returns (1) | ||
| bool | ||
Returns true if the specified UserInputType supports haptic
feedback.
| Thread safety | Unsafe |
|---|
History 2
- 462 Change ThreadSafety of IsVibrationSupported from to Unsafe
- 232 Add IsVibrationSupported
SetMotor
| Parameters (3) | ||
|---|---|---|
| inputType | UserInputType | |
| vibrationMotor | VibrationMotor | |
| vibrationValues | Tuple | |
| Returns (1) | ||
| null | ||
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.
| Thread safety | Unsafe |
|---|