Meer informatie
Engine-klasse
HapticService
Verouderd
Niet maakbaar
Service
Niet gerepliceerd

*Deze inhoud is vertaald met behulp van AI (bèta) en kan fouten bevatten. Klik hier om deze pagina in het Engels te bekijken.


Samenvatting

Overgenomen leden

API-referentie
Methoden
GetMotor
Mogelijkheden: Input
HapticService:GetMotor(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor
Parameters
vibrationMotor:Enum.VibrationMotor
Teruggaves

IsMotorSupported
Mogelijkheden: Input
HapticService:IsMotorSupported(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor
Parameters
vibrationMotor:Enum.VibrationMotor
Teruggaves

IsVibrationSupported
Mogelijkheden: Input
HapticService:IsVibrationSupported(inputType:Enum.UserInputType):boolean
Parameters
Teruggaves

SetMotor
Mogelijkheden: Input
HapticService:SetMotor(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor, vibrationValues:Tuple
):()
Parameters
vibrationMotor:Enum.VibrationMotor
vibrationValues:Tuple
Teruggaves
()
Codevoorbeelden
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
-- Volg deze invoer handmatig om de trillingsmotor nauwkeurig bij te werken
cachedInputs[input] = input.Changed:Connect(onInputChanged)
end
end
end
end
UserInputService.InputBegan:Connect(onInputBegan)

©2026 Roblox Corporation. Roblox, het Roblox-logo en Powering Imagination behoren tot onze geregistreerde en niet-geregistreerde handelsmerken in de VS en andere landen.