Roblox VR in first person lock

I want to make a simple Roblox script that will just lock the player in first person if they’re using VR.

I have made a script, but it seems to have changed nothing and continues to make the camera position stick to one position until the player stops moving. (script shown below)


local VRService = game:GetService("VRService")

if VRService.VREnabled then
			local player = game.Players.LocalPlayer
			player.CameraMode = Enum.CameraMode.LockFirstPerson
		end

I have ran out of ideas and want to make this work.

In PlayerModule → CameraModule → VRBaseCamera the function
VRBaseCamera:SetCameraToSubjectDistance(0) will do it.

1 Like

Where can I find the property SetCameraToSubjectDistance(0)?

you could require VRBaseCamera and call the function from a separate script, or fork your own PlayerModule that forces first person when it loads.

1 Like