Hello Developers,
I am having problems with Haptic Feedback Vibrate effect on mobile. I have searched about topics and nothing I found helped me
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