UserInputService.AccelerometerEnabled code sample incorrect format and missing then keyword

The code sample documented on the UserInputService.AccelerometerEnabled property page has multiple issues which prevent the script from running.


Issue lies on the third and fifth line of the code sample.

Third line: local accelerometerEnabled = UserInputService:AccelerometerEnabled()

Should be: local accelerometerEnabled = UserInputService.AccelerometerEnabled

Fifth line: if accelerometerEnabled

Should be: if accelerometerEnabled then

Error

image

image


Code sample w/ correct changes
local UserInputService = game:GetService("UserInputService")

local accelerometerEnabled = UserInputService.AccelerometerEnabled

if accelerometerEnabled then
	print("The device has an enabled accelerometer!")
else
	print("The device does not have an enabled accelerometer!")
end

Thank you for the report. This issue has now been resolved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.