Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why dosen't my controller trigger vibrations work?

Asked by 5 years ago

This has been a reoccurring problem with my left and right trigger vibration motor scripts. When I set a motor for large or small it works, but with my triggers, nothing. I would check the output, but no errors would occur. I've seen a example of trigger motors used in zombie rush, where if you shoot the right trigger would vibrate. I would use a code like this (A local script in Startergui)

game:GetService("UserInputService").InputChanged:connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.Gamepad1 then
        if input.KeyCode == Enum.KeyCode.ButtonR2 then
            game:GetService("HapticService"):SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.RightTrigger, 1)
            wait(0.4)
            game:GetService("HapticService"):SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.RightTrigger, 0)
        end
    end
end)

game:GetService("UserInputService").InputChanged:connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.Gamepad1 then
        if input.KeyCode == Enum.KeyCode.ButtonL2 then
            game:GetService("HapticService"):SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.LeftTrigger, 1)
            wait(0.4)
            game:GetService("HapticService"):SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.LeftTrigger, 0)
        end
    end
end)

However this doesn't seem to work. Maybe a wiki reference could help.

Answer this question