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

VREnabled

UserGameSettings

bool

Used to override the enabled state of virtual reality when a user has a VR device available to use. If the user has a VR device available and this value is false when the game starts, VR mode will not be initialized.

This setting is only displayed in Roblox’s game menu if a VR device has ever been detected, and this is determined by the UserGameSettings’ UserGameSettings.HasEverUsedVR property.

The value of this property cannot be read by LocalScripts. You should refer to the VRService’s VRService/VREnabled property instead.


Code Samples


UserGameSettings.VREnabled

​This example prints “User is using a VR headset!” if the VREnabled property is true and “User is not using a VR headset!” is the VREnabled property is false.

local VRService = game:GetService("VRService")

local isUsingVr =VRService.VREnabled
if (isUsingVr) then
	print("User is using a VR headset!")
else
	print("User is not using a VR headset!")
end