The code makes hands move relatively to mouse position but when i try to apply same to torso it breaks, any help? Heres the code
local run = game:GetService("RunService")
local tool = script.Parent
local equipped = false
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local char = Player.Character or Player.CharacterAdded:Wait()
tool.Equipped:Connect(function()
equipped = true
end)
run.RenderStepped:Connect(function()
if equipped then
local rightX, rightY, rightZ = char.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
char.Torso["Right Shoulder"].C0 = (char.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))
local rightX, rightY, rightZ = char.Torso.C0:ToEulerAnglesYXZ()
char.Torso.C0 = (char.Torso.C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))
local leftX, leftY, leftZ = char.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
char.Torso["Left Shoulder"].C0 = (char.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))
end
end)
tool.Unequipped:Connect(function()
equipped = false
end)