التعلُّم
Engine Class
HapticEffect

*This content will be available in your selected language soon.


Summary
Methods
Play():()
Stop():()
Inherited Members

API Reference
Properties
Looped
Read Parallel
Capabilities: Input
HapticEffect.Looped:boolean
Code Samples
Looped
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()

Position
Read Parallel
Capabilities: Input
HapticEffect.Position:Vector3
Code Samples
Position
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()

Radius
Read Parallel
Capabilities: Input
HapticEffect.Radius:number
Code Samples
Radius
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()

Type
Read Parallel
Capabilities: Input
HapticEffect.Type:Enum.HapticEffectType

Methods
Play
Capabilities: Input
HapticEffect:Play():()
Returns
()
Code Samples
Play
local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Parent = Workspace
-- Play the haptic effect
effect:Play()

SetWaveformKeys
Capabilities: Input
HapticEffect:SetWaveformKeys(keys:{any}):()
Parameters
keys:{any}
Returns
()
Code Samples
Set Waveform Keys
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 of FloatCurveKeys
-- Time values are in milliseconds; values range from 0 (no haptic) to 1 (full intensity)
local rampUpWaveform = {
FloatCurveKey.new(0, 0.3, Enum.KeyInterpolationMode.Linear),
FloatCurveKey.new(100, 0.4, Enum.KeyInterpolationMode.Linear),
FloatCurveKey.new(300, 0.8, Enum.KeyInterpolationMode.Linear),
FloatCurveKey.new(400, 1.0, Enum.KeyInterpolationMode.Linear)
}
-- Set waveform through the effect's method
effect:SetWaveformKeys(rampUpWaveform)

Stop
Capabilities: Input
HapticEffect:Stop():()
Returns
()
Code Samples
Stop
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()

Events
Ended
Capabilities: Input
HapticEffect.Ended():RBXScriptSignal

©2026 شركة Roblox Corporation. تُعد منصّة Roblox، وشعار Roblox وشعار "توسيع حدود المخيلة"، من ضمن علاماتنا التجارية المسجّلة وغير المسجّلة في الولايات المتحدة وبلدان أخرى.