so because of the release of roblox on meta qeust 2 ( and i own a headset) i tried to make a vr game using a tutorial however it is client-sided so i used a remoteevent to send it to the server wich caused remote event exhausting because it has to fire so much how can i solve this?
local HeadScale = 1
local Cam = workspace.CurrentCamera
Cam.HeadScale = 1
local UIS = game:GetService("UserInputService")
local VRservice = game:GetService("VRService")
local Character = script.Parent
local RS = game:GetService("ReplicatedStorage")
local SG = game:GetService("StarterGui")
local RightHand = Character:WaitForChild("RightHand")
local LeftHand = Character:WaitForChild("LeftHand")
local Head = Character:WaitForChild("Head")
local Runservice = game:GetService("RunService")
if VRservice.VREnabled then
--RS.StarterCharacter.Parent = game.StarterPlayer
print("plr is vr")
SG:SetCore("VRLaserPointerMode",0)
SG:SetCore("VREnableControllerModels",false)
VRservice:RecenterUserHeadCFrame()
VRservice.UserCFrameChanged:Connect(function(thing,cframe)
local RightHandCFrame = VRservice:GetUserCFrame(Enum.UserCFrame.RightHand)
local LeftHandCFrame = VRservice:GetUserCFrame(Enum.UserCFrame.LeftHand)
local HeadCFrame = VRservice:GetUserCFrame(Enum.UserCFrame.Head)
local RightHandMathified = CFrame.new(Cam.CFrame.Position) * CFrame.new((RightHandCFrame.p-HeadCFrame.Position)*HeadScale) * CFrame.fromEulerAnglesXYZ(RightHandCFrame:ToEulerAnglesXYZ())
local LeftHandMathified = CFrame.new(Cam.CFrame.Position) * CFrame.new((LeftHandCFrame.p-HeadCFrame.Position)*HeadScale) * CFrame.fromEulerAnglesXYZ(LeftHandCFrame:ToEulerAnglesXYZ())
local HeadMathified = Cam.CFrame
RightHand.CFrame = RightHandMathified
LeftHand.CFrame = LeftHandMathified
Head.CFrame = HeadMathified
RS.Events.Move:FireServer(RightHandMathified,LeftHandMathified,HeadMathified)
end)
Runservice.RenderStepped:Connect(function()
Cam.HeadLocked = false
Cam.CameraType = Enum.CameraType.Scriptable
local HeadCFrame = VRservice:GetUserCFrame(Enum.UserCFrame.Head)
Cam.CFrame = CFrame.new(0,6,0) * CFrame.new(HeadCFrame.Position) * CFrame.Angles(HeadCFrame:ToEulerAnglesXYZ())
end)
end