HapticService: SetMotor yields code when on ModuleScript

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

wrap it in a coroutine and yield the thread afterwards

It’s the same, I tried task.spawn before too and it didn’t work