PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GyroscopeEnabled

UserInputService

bool

The GyroscopeEnabled property indicates if the user’s device has a gyroscope. It returns true if the local device has a gyroscope, otherwise returns false.

If a user’s device has a gyroscope, you can use incorporate it into your game using the UserInputService/GetDeviceRotation function and UserInputService/DeviceRotationChanged event!

Since UserInputService only runs client-side, this property will only work when used in a LocalScript.


Code Samples


UserInputService.GyroscopeEnabled

This example prints

Gyroscope is enabled!

if the GyroscopeEnabled property is true, and

Gyroscope is not enabled!

if the GyroscopeEnabled property is false.

local UserInputService = game:GetService("UserInputService")

local gyroIsEnabled = UserInputService.GyroscopeEnabled
if (gyroIsEnabled) then
	print("Gyroscope is enabled!")
else
	print("Gyroscope is not enabled!")
end