I tried to add up some stuff on my "test" place, and one of them is vibration. I tried it in Studio, and it works. But when I go online, it doesn't vibrate. My vibration code is:
if game.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) and game.HapticService:IsMotorSupported(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large) then game.HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0.6) wait(0.3) game.HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0) end
If that is actually a bug, someone post this problem on Developer Forum. (I don't have a DevForum account >,>)
There is a small delay when roblox starts to when the controller is connected so you need to wait for the controller to be connected you can use the events GamepadConnected and GamepadDisconnected which fires when a controller is connected and disconnected.
Example:-
-- services local userInpServ = game:GetService('UserInputService') local hptServ = game:GetService('HapticService') -- wait for game pad print('Waiting for gamepad') local gamePad = userInpServ.GamepadConnected:Wait() -- wait for a controller print('Gamepad found', gamePad) -- motor if hptServ:IsMotorSupported(gamePad, Enum.VibrationMotor.Large) then hptServ:SetMotor(gamePad, Enum.VibrationMotor.Large, 0.6) wait(0.3) hptServ:SetMotor(gamePad, Enum.VibrationMotor.Large, 0) else print('Motor not supported') end
I hope this helps.