When I use local script to set motor with haptic service everything works fine, but when I use a modulescript to control it, it yields the code below first :SetMotor forever. Is there any fixes to it?
so it enables the motor, but I can’t disable it since the code yields.
Code:
function HapticController:EnableHaptic(Power: number, Duration: number)
HapticService:SetMotor(Enum.UserInputType.Gamepad1, Power > 1 and Enum.VibrationMotor.Large or Enum.VibrationMotor.Small, (Power > 1 and Power / 2 or Power))
task.delay(Duration, function()
HapticService:SetMotor(Enum.UserInputType.Gamepad1, Power > 1 and Enum.VibrationMotor.Large or Enum.VibrationMotor.Small, 0)
end)
end