Character breaks when looking in a certain direction

I have this script that I’ve been using for a long time now and never had a problem with it. Around a week ago it started glitching (I didn’t edit it at all) weirdly.
The script is supposed to tilt the character’s head, upper body and arms in the direction of the camera. The problem is that if the player isn’t looking exactly forward, the elbows seem to break sideways. This only happens when an animation is played (from other than the default Animate script in the character), and when the waist or shoulder joints’ C0 are manipulated.

The local script:

plr.CharacterAdded:Connect(function(chr)
	char = chr;

	hum = char:WaitForChild("Humanoid");
	
	neck = char:WaitForChild("Head"):WaitForChild("Neck");
	waist = char:WaitForChild("UpperTorso"):WaitForChild("Waist");
	rShoulder = char:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder");
	lShoulder = char:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder");

	neckC0 = neck.C0;
	waistC0 = waist.C0;
	rShoulderC0 = rShoulder.C0;
	lShoulderC0 = lShoulder.C0;
end)

RunService.RenderStepped:Connect(function()
	if not(char) or not(hum) or hum.Health <= 0 then return end
	
	local angle = math.asin(camera.CFrame.LookVector.y);

	neck.C0 = neckC0 * CFrame.fromEulerAnglesYXZ(angle*0.6, 0, 0);
	waist.C0 = waistC0 * CFrame.fromEulerAnglesYXZ(angle*0.2, 0, 0);
	local tool = char:FindFirstChildOfClass("Tool");
	if tool then
		if tool.RightHand.Value then
			rShoulder.C0 = rShoulderC0 * CFrame.fromEulerAnglesYXZ(angle*0.6, 0, 0);
		else
			rShoulder.C0 = rShoulderC0;
		end
		if tool.LeftHand.Value then
			lShoulder.C0 = lShoulderC0 * CFrame.fromEulerAnglesYXZ(angle*0.6, 0, 0);
		else
			lShoulder.C0 = lShoulderC0;
		end
	else
		rShoulder.C0 = rShoulderC0;
		lShoulder.C0 = lShoulderC0;
	end
	
	--game.ReplicatedStorage.ServerEvents.Tilt:FireServer(rShoulder.C0, lShoulder.C0, neck.C0, waist.C0);
end)

Demonstration:

I tried looking at the joint’s properties to see if anything changes when they “break” but I couldn’t find anything.

Thanks for any help

This doesn’t seem to be an error on your end.

I tried to play around a little and only found out that this only happens when you set Waist’s C0 (or C1) orientation on X axis to any value that’s higher than approximately 0.58° or lower than -0.58°. When you comment out the line which changes Waist’s C0, the issue stops occurring.

Unfortunately, I can’t think of any way how you could solve this. I’d suggest filing an engine bug report at this point.

1 Like

I didn’t go as far as to calculate the exact angles but I noticed the same thing. I’ll try to report the issue cause it’s really game-breaking and annoying.

I appreciate the help

Do you by any chance know how I could file a bug report if I cant post in the topic yet?

1 Like

I’ve just noticed the same issue. Did you manage to find a solution?

Nothing yet. We suspect it’s an engine bug so there might not be a very real or good solution. I’d write a bug report but I don’t have permission yet

1 Like