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

GetUserCFrameEnabled

The GetUserCFrameEnabled function returns true if the specified Enum/UserCFrame virtual reality device (VR) is available to be listened to.

This can be used to determine whether a specified VR device, (e.g. UserCFrame.Head), is connected to the user’s game. If the specified VR device is connected, is it enabled (true). Otherwise, it is disabled (false).

This can also be used alongside the several /UserInputService VR functions and events.

Since /VRService only runs client-side, this function will only work when used in a /LocalScript.

Parameters

Name Type Default Description

The specified type of VR device.

Returns

Return Type Summary

A boolean indicating whether the specified VR device is enabled (true) or disabled (false).


Code Samples


VRService:GetUserCFrameEnabled

​​This example indicates whether the UserCFrame.Head VR device is enabled or disabled for the user. If the device is enabled, this prints “VR device is enabled!”. If the device is disabled, this prints “VR device is disabled!”.

local VRService = game:GetService("VRService")

local isEnabled = VRService:GetUserCFrameEnabled(UserCFrame.Head)
if (isEnabled) then
	print("VR device is enabled!")
else
	print("VR device is disabled!")
end)