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