Reference API Roblox

Engine API

Website

Related

Reference API Roblox

VRService

Service responsible for handling interactions between Roblox and Virtual Reality (VR).

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 29

HistoryMember
614AutomaticScaling: VRScaling
623AvatarGestures: bool
638ControllerModels: VRControllerModelMode
614FadeOutViewOnCollision: bool
612GuiInputUserCFrame: UserCFrame
638LaserPointer: VRLaserPointerMode
610ThirdPersonFollowCamEnabled: bool
614VREnabled: bool
462GetTouchpadMode(pad: VRTouchpad): VRTouchpadMode
462GetUserCFrame(type: UserCFrame): CFrame
462GetUserCFrameEnabled(type: UserCFrame): bool
548IsMaquettes(): bool
548IsVRAppBuild(): bool
573RecenterUserHeadCFrame(): null
573RequestNavigation(cframe: CFrame, inputUserCFrame: UserCFrame): null
573SetTouchpadMode(pad: VRTouchpad, mode: VRTouchpadMode): null
572LaserPointerTriggered(input: InputObject)
462NavigationRequested(cframe: CFrame, inputUserCFrame: UserCFrame)
462TouchpadModeChanged(pad: VRTouchpad, mode: VRTouchpadMode)
462UserCFrameChanged(type: UserCFrame, value: CFrame)
462UserCFrameEnabled(type: UserCFrame, enabled: bool)
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

VRService is responsible for handling interactions between Roblox and Virtual Reality (VR). Its methods, properties, and events help you provide the best experience for end users seeking to experience Roblox on VR devices.

See VR Guidelines for more information on publishing an experience for VR devices.

History 103

Members 29

AutomaticScaling

TypeDefault
VRScalingWorld

When set to VRScaling.World, Camera.HeadScale adjusts so that the scale of the world is seen from the avatar's perspective. A player with a small avatar will perceive the objects around them as larger than a player with a large avatar will.

History 6

AvatarGestures

TypeDefault
boolfalse

When set to true, a VR player will be able to animate their hands and head using their controllers and headset.

This property must be set on the server.

History 2

ControllerModels

TypeDefault
VRControllerModelModeTransparent

History 1

FadeOutViewOnCollision

TypeDefault
booltrue

When true, a VR player's view fades to black when their head collides with an object. This property prevents players from being able to see through walls while in VR. The default value is true.

History 7

GetTouchpadMode

Parameters (1)
padVRTouchpad
Returns (1)
VRTouchpadMode

This method returns the VRTouchpadMode indicating the mode of a specified VRTouchpad. The returned mode indicates how the user interacts with their touchpad to play the game.

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

This method will only work when used in a LocalScript.

History 2

GetUserCFrame

Parameters (1)
typeUserCFrame
Returns (1)
CFrame

This method returns a CFrame describing the position and orientation of a specified virtual reality (VR) device as an offset from a point in real world space. This method should be used when implementing VR compatibility into a game to obtain and track the movement of a connected VR device.

By using the method, developers can implement features such as re-positioning the user's in-game character corresponding to the location of a connected VR device. This can be done by changing the CFrame of the user's in-game character to match the CFrame of the specified VR device using the UserCFrame enum and CFrame value arguments passed by the event.

VRService also provides a UserCFrameChanged event that automatically fires when the CFrame of connected VR device changes, so long it is used in a LocalScript.

This method will only work when used in a LocalScript.

History 4

GetUserCFrameEnabled

Parameters (1)
typeUserCFrame
Returns (1)
bool

This method returns true if the specified UserCFrame virtual reality device (VR) is available to be listened to. It can be used to determine whether a specified VR device, such as UserCFrame.Head, is connected to the user's game.

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

This method will only work when used in a LocalScript.

History 4

GuiInputUserCFrame

TypeDefault
UserCFrameHead

This property describes what UserCFrame is responsible for input in VR. For instance, if a VR headset is responsible, the value of this property will be UserCFrame.Head.

To check if Roblox detects any VR devices, which would be responsible for input in VR, you can check the VREnabled property.

This property is not replicated. Its interface does not cross the network boundary.

History 11

Tags: [NotReplicated]

IsMaquettes

Parameters (0)
No parameters.
Returns (1)
bool

History 1

IsVRAppBuild

Parameters (0)
No parameters.
Returns (1)
bool

History 1

LaserPointer

TypeDefault
VRLaserPointerModePointer

History 1

LaserPointerTriggered

Parameters (1)
inputInputObject

History 1

NavigationRequested

Parameters (2)
cframeCFrame
inputUserCFrameUserCFrame

This event fires when navigation is requested from VRService for a specified UserCFrame VR device. It fires with a CFrame coordinate and the specified UserCFrame indicating the device requesting the navigation.

This event can be used alongside UserInputService service events and methods.

Since this event fires locally, it can only be used in a LocalScript.

History 2

RecenterUserHeadCFrame

Parameters (0)
No parameters.
Returns (1)
null

This method re-centers the CFrame of the user's head to the current location of the VR headset being worn by the user. It can be used to ensure that the user's in-game head is positioned according to the location of the user's VR headset.

This behaves identically to UserInputService:RecenterUserHeadCFrame().

This method will only work when used in a LocalScript.

History 5

RequestNavigation

Parameters (2)
cframeCFrame
inputUserCFrameUserCFrame
Returns (1)
null

This method requests navigation to the specified CFrame using the specified UserCFrame as the origin for the visualizer parabola. It can be used to incorporate virtual reality (VR) into your game by providing a means to visualize a navigation path from the user's VR device to a destination.

VRService has a similar event, NavigationRequested, used to detect such requests. This can also be used alongside the several UserInputService VR methods and events.

This method will only work when used in a LocalScript.

History 3

SetTouchpadMode

Parameters (2)
padVRTouchpad
modeVRTouchpadMode
Returns (1)
null

This method sets the mode of the specified VRTouchpad to the specified VRTouchpadMode. It can be used to change the user's virtual reality (VR) touchpad mode so that the user interacts with the game differently using the touchpad.

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

This method will only work when used in a LocalScript.

History 3

ThirdPersonFollowCamEnabled

TypeDefault
booltrue
This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 2

Tags: [ReadOnly, NotReplicated]

TouchpadModeChanged

Parameters (2)
padVRTouchpad
modeVRTouchpadMode

This event fires if the VRTouchpadMode of a VRTouchpad is changed. You can use this event to track the states of VR touchpads connected via the user's client.

This event can be used alongside UserInputService service events and methods.

Since this event fires locally, it can only be used in a LocalScript.

History 2

UserCFrameChanged

Parameters (2)
typeUserCFrame
valueCFrame

This event fires when a UserCFrame is changed, for instance when the user moves a connected VR device. It can be used alongside GetUserCFrame() to track the CFrame coordinates of a VR device, and when it changes/moves. It can also be used alongside UserInputService service events and methods.

Since this event fires locally, it can only be used in a LocalScript.

History 4

UserCFrameEnabled

Parameters (2)
typeUserCFrame
enabledbool

This event fires when a UserCFrame is enabled or disabled. It can be used alongside GetUserCFrameEnabled() to track whether a specified UserCFrame is enabled, and when its state changes. It can also be used alongside UserInputService service events and methods.

Since this event fires locally, it can only be used in a LocalScript.

History 4

VREnabled

TypeDefault
boolfalse

This property describes whether the user is using a virtual reality (VR) device.

If a VR device is enabled, you can interact with its location and movement through methods such as UserInputService:GetUserCFrame(). You can also react to VR device movement using the UserInputService.UserCFrameChanged event.

1
2
3
4
5
6
7
8
local UserInputService = game:GetService("UserInputService")

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

This property can only be used in a LocalScript.

See Also

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 8

Tags: [ReadOnly, NotReplicated]

Settings