Haptic Service problem on Mobile

Hello Developers,

I am having problems with Haptic Feedback Vibrate effect on mobile. I have searched about topics and nothing I found helped me :face_exhaling:

My Code

I am running the SetMotor() in a ModuleScript located on the client.

The weird part is, I created another script (On the client) and ran it. That worked for some reason.

Also, all of the prints do work, so I know that Viberation is supported on the client.

function PopUpService:NotifyPlayer(Header, Message, MotorEnabled)
	
	if MotorEnabled then
		local Success, Error = pcall(function()
			print("Player Motor")
			if HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) then
				print("Viberation Supported!")
				HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0.9) -- Not Playing???
			end
			print("Player Motor Finished")
		end)
		
		if not Success then
			warn("Error on HapticService. Error Message: "..Error)
		end
	end
	
	local NotifyTop = PopUps:WaitForChild("NotifyTop")
	NotifyTop.Content.Holder.NotifyContent.Header.Text = Header
	NotifyTop.Content.Holder.NotifyContent.Description.Text = Message
	
	TweenService:Create(NotifyTop.Content.Gradient, TweenInfo.new(1), {ImageTransparency = 0.5}):Play()
	TweenService:Create(NotifyTop.Content.Holder.NotifyContent, TweenInfo.new(1), {Position = UDim2.new(0, 0, 0, 0)}):Play()
	
end

What have I tried

Changes to Code Results
Not using HapticServer:IsViberationSupported() Failed
Changing Enum.UserInputType to Touch Failed
Changing HapticService:IsMotorSupported() Failed
Create a new LocalScript with same code Worked
That Code
local HapticService = game:GetService("HapticService")

if HapticService:IsMotorSupported(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large) then
	print("Motor is supported")
	HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0.5)
	print(HapticService:GetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large))
end

if HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) then
	print("Vibration is supported")
	HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0.5)
	HapticService:GetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large)
end

I think that Roblox just doesn’t allow you to use Haptic Service for mobile devices. I’m pretty sure there was a feature request for it to be comparable with mobile devices but I guess it’s still a request.

Yeah, I have looked through those topics and I did find some replies saying that it did work, but it stopped working for some reason?

And as I stated in my post I was able to get it working in another script for mobile devices. But when I tried putting it into either another LocalScript or ModuleScript it wouldn’t work.

1 Like

Update:

After some messing around, I was able to get the Haptic Feedback to work on Controller, but not Mobile.

I have moved the Vibrate code to a Local Script.

if HapticService:IsMotorSupported(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large) then
	HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 1)
end

I still have no idea why it won’t work on mobile :no_mouth: