VR development in Roblox Studio has become nearly unusable because VRService.VREnabled isn’t set early enough during startup.
If a script checks VRService.VREnabled immediately when the game starts, it’ll often return false even though Studio is already running in VR. The only reliable workaround right now is adding a task.wait() before checking it, which obviously shouldn’t be necessary.
This issue has been tested across multiple place files, so it doesn’t appear to be specific to a single experience or project.
Expected behavior
VRService.VREnabled should already be set before scripts begin running so developers can reliably detect whether VR is active
A LocalScript in ReplicatedFirst initially gets false from both UserInputService.VREnabled and VRService.VREnabled.
This happens in both the Device Emulator, and actually having the headset on. It takes my client anywhere from 0.5-2 seconds since execution before VREnabled finally changes to true.
UserCFrameChanged can begin to fire whileVRService.VREnabled is still false.
My initial workarounds are to either listen for UserCFrameChanged and connect my specific VR setup with :Once(), or check a few times over a second or two for VREnabled. Ideally, it should be true instantly.
local VRService = game:GetService("VRService")
local userCFrameConnection = nil
userCFrameConnection = VRService.UserCFrameChanged:Connect(function()
warn("UserCFrameChanged fired!")
end)
print(`VREnabled: {VRService.VREnabled}`)
local now = os.clock()
while VRService.VREnabled == false do
task.wait()
end
userCFrameConnection:Disconnect()
print(`VRService took {os.clock() - now} to be 'true'`)