So, i’ve made the gun that aims to the mouse position, but it have strange offset and angle isn’t correct, does anyone know why?
local CurrentCFrameR = RShoulder.C1
local CurrentCFrameL = LShoulder.C1
local OffsetR = CFrame.new(RightArm.Position):ToObjectSpace(Torso.CFrame)
local X,Y,Z = CFrame.lookAt(Character.PrimaryPart.Position, Hit):ToObjectSpace(
Character.PrimaryPart.CFrame):ToEulerAnglesXYZ()
X += 0.1
RShoulder.C1 = CFrame.new(-0.5, 0.5, 0)
* CFrame.Angles(0, math.pi / 2, math.clamp(X, -1, 1))
LShoulder.C1 = CFrame.new(0.5, 0.5, 0)
* CFrame.Angles(0, -math.pi / 2, math.clamp(-X, -1, 1))
end)