How can i fix this "gun points a cursor script"

i dont know how to fix this i have very small knowledge on how to do this but this is what i got when i done it:


i think the animation of the gun bugs it:

here is the script:


game:GetService("RunService").RenderStepped:Connect(function()
	if Equipped then
		local rightX, rightY, rightZ = Player.Character.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
		Player.Character.Torso["Right Shoulder"].C0 = (Player.Character.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((Mouse.Hit.p - Mouse.Origin.p).unit.y))

		local leftX, leftY, leftZ = Player.Character.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
		Player.Character.Torso["Left Shoulder"].C0 = (Player.Character.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)
1 Like