How to stop haptic feedback vibration

I am trying to add haptic feed back to my game, but as i was testing it i realized that although i set the motors to 0 they would not stop and sometimes they would even continue to run after i stopped the game

this is the code i used to try and control the haptic feedback

local uis = game:GetService(“UserInputService”)
local HapticService = game:GetService(“HapticService”)

uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.ButtonX then
HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Small, 0.5)
wait(2)
HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Small, 0)
print(“Off”)
end
end)

ive tried looking around the forums and i saw 1 other person mention the problem but i saw no solution
i dont know if its a bug or something, please help

Yeah, I also had this issue. Sometimes, for me anyways, it would vibrate for a while after I set it to 0, then it would stop. I was using the command bar for testing when I came across this. I could not find anything that would get this to stop, however. :thinking:

EDIT: I did find that same report you mentioned earlier.
Post. It appears that this is a problem with the Haptic Feedback Vibration. I don’t know how you would bring this to the attention of ROBLOX but the postyou mentioned earlier was in the #platform-feedback bug report section so I don’t know… :smile:

1 Like

I was doing it in a module, now I tried local script and it worked out. also the code after setting the motor would yield, IDK if this would help you

congratulations on the worst necropost ive seen ever