I have a LocalScript under StarterPlayerScripts, and with it I would like to detect if a player is using a VR Headset (Check if it’s connected), and if so, set their Camera to be their VR Headset.
Setting the Camera as their VR Headset allows them to look around using their VR Headset, as this isn’t enabled by default.
local VRService = game:GetService("VRService")
local camera = workspace.CurrentCamera
if VRService.VREnabled then
VRHead = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local CameraStart = workspace:WaitForChild("CameraStart")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CameraStart.VRHead.CFrame
end
I’ve tried the script above, but it did not work, any help appreciated!