Pelajari
Kelas Engine
HapticService
Tidak digunakan lagi
Tidak Dapat Dibuat
Layanan
Tidak Direplikasi

*Konten ini diterjemahkan menggunakan AI (Beta) dan mungkin mengandung kesalahan. Untuk melihat halaman ini dalam bahasa Inggris, klik di sini.


Rangkuman
Anggota yang Diwariskan

Referensi API
Metode
GetMotor
Kemampuan: Input
HapticService:GetMotor(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor
Parameter
vibrationMotor:Enum.VibrationMotor
Memberikan nilai

IsMotorSupported
Kemampuan: Input
HapticService:IsMotorSupported(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor
Parameter
vibrationMotor:Enum.VibrationMotor
Memberikan nilai

IsVibrationSupported
Kemampuan: Input
HapticService:IsVibrationSupported(inputType:Enum.UserInputType):boolean
Parameter
Memberikan nilai

SetMotor
Kemampuan: Input
HapticService:SetMotor(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor, vibrationValues:Tuple
):()
Parameter
vibrationMotor:Enum.VibrationMotor
vibrationValues:Tuple
Memberikan nilai
()
Contoh Kode
HapticService:SetMotor()
local UserInputService = game:GetService("UserInputService")
local HapticService = game:GetService("HapticService")
local cachedInputs = {}
local keyToVibration = {
[Enum.KeyCode.ButtonL2] = Enum.VibrationMotor.Small,
[Enum.KeyCode.ButtonR2] = Enum.VibrationMotor.Large,
}
local function onInputChanged(property)
if property == "Position" then
HapticService:SetMotor(inputType, vibrationMotor, input.Position.Z)
end
end
local function onInputBegan(input)
if not cachedInputs[input] then
local inputType = input.UserInputType
if inputType.Name:find("Gamepad") then
local vibrationMotor = keyToVibration[input.KeyCode]
if vibrationMotor then
-- Amati input ini secara manual untuk memperbarui motor getaran dengan akurat
cachedInputs[input] = input.Changed:Connect(onInputChanged)
end
end
end
end
UserInputService.InputBegan:Connect(onInputBegan)

©2026 Roblox Corporation. Roblox, logo Roblox, dan Powering Imagination termasuk dalam merek dagang kami yang terdaftar dan tidak terdaftar di AS dan negara lainnya.