Introducing New Updates to the Haptics System

Hi Creators!

We’re excited to announce two great updates to our Haptics system, making it more powerful and easier to learn. As a quick refresher, haptics refer to tactile feedback – like a buzz or a rumble – used to enhance immersion in a game. Many of you have already added them to your experiences since our full release of HapticEffects earlier this year, whether you’re using one of our predefined effects or creating your own!

Today, we’re announcing:

  • :sparkles: The new HapticEffect:Ended event: This tells you when a HapticEffect is done playing.
  • :video_game: Haptics in Studio Templates: You can now get haptics out-of-the-box in multiple Templates and take inspiration from these examples.

Keep reading to learn more!

Introducing HapticEffect:Ended

We’ve heard your feedback and added the new HapticEffect:Ended event, which fires when your HapticEffect has completed playback and stopped.

This is critical for good memory management. It allows you to reliably perform garbage collection and destroy the HapticEffect only once it has completed playback, which helps you save memory when haptics are not active.

Here’s how you would use it in practice:

local effect = Instance.new("HapticEffect")
effect.Parent = workspace
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect:Play()

-- Connect to the event to clean up the instance
effect.Ended:Connect(function()
  print("Haptic Effect Finished")
  effect:Destroy()
end)

Haptics in Studio Templates

To help you get started, we’ve integrated haptics directly into our standard Studio Templates. Even if you aren’t starting from scratch, we encourage you to open them up to see how we wired up the effects – they could be applicable to your game as well!

When you open these templates, you’ll find:

  • :sunset: Platformer: A light buzz when collecting coins. This is a great example of how to integrate haptics into UI/UX.
  • :police_car_light: Laser tag / FPS: Unique vibrations when firing different weapons. This shows you how to integrate haptics into gameplay.
  • :chequered_flag: Racing: Strong rumbles when activating nitro, plus dynamic haptics that vary in intensity based on collision force. Check this out for an advanced use case where the haptic curve is dynamically generated each time it is triggered.

You can find these under the Templates tab in Studio.

:blue_heart: Made with love

These new improvements were made possible thanks to @RickleSandwich, @LittleEel0621, @runitbackrolfo, and @MetaVars.

We’ve loved seeing your implementations of haptics & cannot wait to see more! Let us know about your experience and if you encounter any issues! :grinning_face_with_smiling_eyes:

107 Likes

This topic was automatically opened after 10 minutes.

Brb im boutta go put my mobile and console players in an earthquake

43 Likes

Excellent update. The new HapticEffect.Ended event is a small but very useful change for optimizing memory management and having better control over the duration of effects.

It would be great if the HapticEffect documentation included a video showing how the different effects feel in-game.

15 Likes

When will we get PS5 Controller support for this?

Speed please I need this!
my mom is kinda-a homeless
I live with my dad I want to help her out.

9 Likes

Oh, I only have the Logitech F310 controller. No haptic testing for me, then.

13 Likes

Awesome! These changes will make it even easier to make stuff, especially with the templates :tongue:

1 Like

I’m having a big issue with haptics where the HapticEffect doesn’t stop even though I called :Stop(). I’ve been able to record it happening, showing the output print of the function, showing the code fired, and the vibration of the controller still going (shown by audio picked up on mic from being on a table).

I’ve had this issue for months, but only tried to capture it now. I’ll try some more stuff out on my own, and then file a bug report and link it here. I’m late for a class though -got wrapped up in this- so I’ll have to work this out later, great update! :sweat_smile:

3 Likes

Is there any plan to support ps5 adaptive triggers? I might be in the minority here but i absolutely love them and would love to be able to take advantage of them with haptics!

2 Likes

A Video, that shows how they feel???
I would Suggest just testing them in with a second device.

Are you able to disclose if there are any plans to expand the input and haptic system to include native support for racing wheels on PC or Console?

The use case for such a feature is somewhat niche, and workarounds already exist that allow for implementation of force feedback and racing wheel support within games that do require it. While this would be a cool thing to implement, I just don’t see Roblox adding it anytime soon

Excellent! I suggest a feature that allows you to preview the vibration in the studio, either audibly by simulating a motor or visually with a spectrum.

This may seem like a silly suggestion, but it’s far from it: many of us, myself included, don’t have a controller or alternative device, except for my phone, but there’s no way to link the phone and the studio to test them in real time without having to test them manually and adjust the sequence, publishing the place and so on in a loop. It’s simply a waste of time, so some way of knowing that it’s there would be a great help.

1 Like

Nice! However, Ended is bugged. It doesn’t actually work and never fires.

Reproduction file: Haptics Bug.rbxl (58.2 KB)

2 Likes

From what I’ve observed, it only fires if a gamepad is connected

1 Like

I’ve been trying to use these HapticEffect instances but they don’t seem to work with any of my controllers. I set it up with explosions in my game and it just won’t vibrate the controller. I tried a Play Station 4 controller and an Xbox Controller, neither of them have any response to the HapticEffects.

EDIT: I resolved this issue. however, this code block here instantly crashes studio after the haptics end.

local function doHaptics(position: Vector3, radius: number, hapticType: Enum.HapticEffectType, waveForm: CustomWaveForm?)
	local relativePosition = camera.CFrame:PointToObjectSpace(position)
	
	print(relativePosition)
	
	local hapticEffect = Instance.new("HapticEffect")
	hapticEffect.Position = relativePosition
	hapticEffect.Radius = radius
	
	if waveForm then
		hapticEffect.Type = Enum.HapticEffectType.Custom
		hapticEffect:SetWaveformKeys(waveForm)
	elseif hapticType then
		hapticEffect.Type = hapticType
	end
	
	hapticEffect.Parent = hapticFolder
	hapticEffect:Play()
	
	hapticEffect.Ended:Once(function()
		hapticEffect:Destroy()
	end)
end

EDIT2: this code does NOT crash studio if the ended event is commented out.

2 Likes

@kirbyFirer Thanks for the report, since we were not able to reproduce it on our side, is it possible for you to send us the crash log? We would like to look into this issue.

3 Likes

I think you meant to tag @kirbyFirer?

1 Like

Hi. I experienced an issue with HapticEffect instances by using the Ended event. It’s looks like if Workspace.SignalBehavior is set to Immediate or AncestryDeferred, studio crashes after Ended fire. Other places that I have Workspace.SignalBehavior = Deferred it’s not happening.

task.wait(3)
print("Playing effect.")

local hapticEffect = Instance.new("HapticEffect")
hapticEffect.Type = Enum.HapticEffectType.UIClick
hapticEffect.Parent = workspace
hapticEffect.Ended:Once(function()
	hapticEffect:Destroy()	-- Crash!
end)
hapticEffect:Play()
task.wait(3)
print("Playing effect.")

local hapticEffect = Instance.new("HapticEffect")
hapticEffect.Type = Enum.HapticEffectType.UIClick
hapticEffect.Parent = workspace
hapticEffect.Ended:Once(function()
	task.wait() -- workaround if Workspace.SignalBehavior ~= Deferred
	hapticEffect:Destroy()	-- No crash
end)
hapticEffect:Play()

Thanks for the detailed report, we have identified the root cause and will work on a fix soon.

2 Likes