HapticEffect
Memory category | Instances |
---|
Member index 8
Removed member index 1
History | Member | |
---|---|---|
655 | SetKeys(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 16
- 665 Change Tags of HapticEffect from [] to [NotBrowsable]
- 655 Add SetWaveformKeys
- 655 Remove SetKeys
- 655 Change WriteSecurity of Radius from RobloxScriptSecurity to None
- 655 Change ReadSecurity of Radius from RobloxScriptSecurity to None
- 655 Change WriteSecurity of Position from RobloxScriptSecurity to None
- 655 Change ReadSecurity of Position from RobloxScriptSecurity to None
- 648 Add SetKeys
- 638 Add Stop
- 638 Add Play
- 638 Add Waveform
- 638 Add Type
- 638 Add Radius
- 638 Add Position
- 638 Add Looped
- 638 Add HapticEffect
Members 8
Looped
Type | Default | |
---|---|---|
bool | false |
Whether the haptic effect loops continuously.
local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Looped = true
effect.Parent = Workspace
-- Start the haptic effect
effect:Play()
-- After two seconds, stop the effect
task.wait(2)
effect:Stop()
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
Play
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Plays the haptic effect.
local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Parent = Workspace
-- Play the haptic effect
effect:Play()
Thread safety | Unsafe |
---|
Position
Type | Default | |
---|---|---|
Vector3 | 0, 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.

local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
-- Set the position and radius of impact
effect.Position = Vector3.new(0.5, 0.5, 0)
effect.Radius = 1
effect.Parent = Workspace
effect:Play()
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
Radius
Type | Default | |
---|---|---|
float | 3 |
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.

local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
-- Set the position and radius of impact
effect.Position = Vector3.new(0.5, 0.5, 0)
effect.Radius = 1
effect.Parent = Workspace
-- Play the haptic effect
effect:Play()
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
SetWaveformKeys
Parameters (1) | ||
---|---|---|
keys | Array | |
Returns (1) | ||
null |
This method lets you define a custom waveform as a table and apply it to the haptic.
local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
-- Set effect type to custom in order to define a waveform
effect.Type = Enum.HapticEffectType.Custom
effect.Parent = Workspace
-- Define the custom waveform curve through a table
local rampUpWaveform = {
FloatCurveKey.new(0, 0.3),
FloatCurveKey.new(100, 0.4),
FloatCurveKey.new(300, 0.8),
FloatCurveKey.new(400, 1.0)
}
-- Set waveform through the effect's method
effect:SetWaveformKeys(rampUpWaveform)
Thread safety | Unsafe |
---|
History 1
- 655 Add SetWaveformKeys
Stop
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Stops the haptic effect.
local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Looped = true
effect.Parent = Workspace
-- Start the haptic effect
effect:Play()
-- After two seconds, stop the effect
task.wait(2)
effect:Stop()
Thread safety | Unsafe |
---|
Type
Type | Default | |
---|---|---|
HapticEffectType | UIClick |
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().
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
Waveform
Type | Default | |
---|---|---|
FloatCurve |
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | true |