(posting for a friend)
I’m trying to create a VR game, and so far everything has been going smoothly. However, no matter what I try, I am unable to disable the VR laser pointer and controller models.
Here is the part that I’m having issues with (I omitted the variable declarations and whatnot as those aren’t relevant):
if VRService.VREnabled then
task.wait(.2)
StarterGUI:SetCore("VRLaserPointerMode", 0)
StarterGUI:SetCore("VREnableControllerModels", false)
VRService:RecenterUserHeadCFrame()
Camera.HeadScale = HeadScale
VRService.UserCFrameChanged:Connect(function()
local RightHandCFrame = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
local LeftHandCFrame = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
local HeadCFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local RightHandCorrectedCFrame = CFrame.new(Camera.CFrame.Position) * CFrame.new((RightHandCFrame.p-HeadCFrame.Position)*HeadScale) * CFrame.fromEulerAnglesXYZ(RightHandCFrame:ToEulerAnglesXYZ())
local LeftHandCorrectedCFrame = CFrame.new(Camera.CFrame.Position) * CFrame.new((LeftHandCFrame.p-HeadCFrame.Position)*HeadScale) * CFrame.fromEulerAnglesXYZ(LeftHandCFrame:ToEulerAnglesXYZ())
local HeadCorrectedCFrame = Camera.CFrame
RightHand.CFrame = RightHandCorrectedCFrame
LeftHand.CFrame = LeftHandCorrectedCFrame
Head.CFrame = HeadCorrectedCFrame
ContextActionService:BindAction(ACTION_GRAB_R, handleAction, true, Enum.KeyCode.ButtonR1)
ContextActionService:BindAction(ACTION_GRAB_L, handleAction, true, Enum.KeyCode.ButtonL1)
end)
RunService.RenderStepped:Connect(function()
Camera.HeadLocked = false
Camera.CameraType = Enum.CameraType.Scriptable
local HeadCFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
Camera.CFrame = CFrame.new(0, 5, 0) * CFrame.new(HeadCFrame.Position) * CFrame.Angles(HeadCFrame:ToEulerAnglesXYZ())
end)
end
As you can see, at the top of my script, I attempt to do so with
task.wait(.2)
StarterGUI:SetCore("VRLaserPointerMode", 0)
StarterGUI:SetCore("VREnableControllerModels", false)
The task.wait(.2) was an attempt at waiting until i was able to set the gui core, but no matter how long i paused it for nothing worked.
I have also tried Player.CharacterAdded:Wait() as suggested by others, but this merely prevented my character from loading.
Any help?