AlignOrientation or my math isnt orientating the hand properly

task.wait(2)
local VrMode = false
local VRS = game:GetService("VRService")
local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer.Character
local HeadScale = 1
local Cam = game.Workspace.CurrentCamera
if VRS.VREnabled == true then
    VrMode = true
    print("User is using a VR headset!")
    Cam.HeadLocked = true
    Cam.CameraType = Enum.CameraType.Scriptable
else
    print("User is not using a VR headset!")
end

VRS.UserCFrameChanged:Connect(function(Part, move)
    local HeadCFrame = VRS:GetUserCFrame(Enum.UserCFrame.Head)
    if VrMode == true then
        player.Head.CFrame = HeadCFrame + Vector3.new(0,5,0)
        Cam.CFrame = player.Head.CFrame 
        if Part == Enum.UserCFrame.LeftHand then
            local x,y,z = (Cam.CFrame * move ):ToOrientation()
            player.LeftHand.Handle.AlignPosition.Position = (Cam.CFrame * move * CFrame.Angles(math.rad(0),math.rad(180),math.rad(270))).Position
            player.LeftHand.Handle.AlignOrientation.PrimaryAxis = Vector3.new(math.deg(x),math.deg(y),math.deg(z))
        elseif Part == Enum.UserCFrame.RightHand then
            player.RightHand.Handle.CFrame = Cam.CFrame * move * CFrame.Angles(math.rad(0),math.rad(180),math.rad(90))
            end
        end
end)
local USR = game:GetService("UserInputService")
USR.InputBegan:Connect(function(input)
    if input == Enum.KeyCode.ButtonL2 then
        
    end
end)

The issue is align orientation is orientating correctly it works perfectly fine using CFrame
Just ask if you have any questions

It’s possible that the AlignOrientation property is not being updated correctly or the math used to calculate the orientation is incorrect.

One suggestion to try is to update the AlignOrientation property based on the orientation of the hand relative to the camera. You can do this by first getting the relative CFrame of the hand to the camera using the Inverse method and then converting the resulting CFrame to an orientation using the ToOrientation method. Here’s an example of how you can update the AlignOrientation property for the left hand:

local relativeCFrame = Cam.CFrame:Inverse() * (player.LeftHand.Handle.AlignPosition.Position * CFrame.Angles(math.rad(0),math.rad(180),math.rad(270)))
local orientation = relativeCFrame:ToOrientation()
player.LeftHand.Handle.AlignOrientation.PrimaryAxis = Vector3.new(math.deg(orientation.x), math.deg(orientation.y), math.deg(orientation.z))

You can also try using the LookVector property of the camera to set the orientation of the hand. This can be done by setting the PrimaryPart of the AlignOrientation to the handle of the hand and then setting the LookVector of the camera to the PrimaryAxis of the AlignOrientation . Here’s an example of how you can update the AlignOrientation property for the left hand:

player.LeftHand.Handle.AlignOrientation.PrimaryPart = player.LeftHand.Handle
player.LeftHand.Handle.AlignOrientation.PrimaryAxis = Cam.CFrame.LookVector

Try experimenting with these approaches to see which one works best for your specific use case.