Arms not properly rotating with camera (R15)

Because of the risk of R6 getting depreciated, and the R15 to R6 adapter not working as well, I am trying to allow both R6 and R15 to work for my game. One of the things I have to change around a bit is limb rotation with the camera.

How it works is that the head will always rotate while the arms will only rotate if there is a tool detected. The head has no issues, just the arms.

This is what it looks like functioning in R6:
image

It only works when the character spawns with no animations at all:

The rest of the time it looks like this:
image

There are no other scripts that I know of that attempt to change the C0 of the Motor6s in the arms. I should also note that if I do move fast enough, it appears that it attempts to apply the rotation, but then snaps back to the state in the 3rd image.

Here is the code for the rotation:

local Resources = {
	Character = script.Parent,
	Head = script.Parent:WaitForChild("Head"),
	LeftArmMotor = script.Parent:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder"),
	RightArmMotor = script.Parent:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder"),
	HeadMotor = script.Parent.Head:WaitForChild("Neck"),
	Root = script.Parent:WaitForChild("HumanoidRootPart"),
	Communicator = ReplicatedStorage:WaitForChild("RemoteEvent"), --Censored for security
	Camera = game.Workspace:WaitForChild("Camera")
}
--Variables
local HasTool = false
local SendOut = 0
--Functions
local Functions = {
	OffsetMotors = function()
		if Resources.Root ~= nil and Resources.Character.Humanoid.Health > 0 then
			if Resources.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
				Resources.HeadMotor.C0 = CFrame.new(Resources.HeadMotor.C0.Position) * CFrame.Angles(Resources.Camera.CFrame.LookVector.Y + math.rad(90), math.rad(-180), -Resources.Root.CFrame:ToObjectSpace(Resources.Camera.CFrame).LookVector.X)
			else
				Resources.HeadMotor.C0 = CFrame.new(Resources.HeadMotor.C0.Position) * CFrame.Angles(Resources.Camera.CFrame.LookVector.Y, -Resources.Root.CFrame:ToObjectSpace(Resources.Camera.CFrame).LookVector.X, 0)
			end
			if HasTool == true then
				if Resources.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
					Resources.LeftArmMotor.C0 = CFrame.new(Vector3.new(-1, 0.5, 0)) * CFrame.Angles(Resources.Camera.CFrame.LookVector.Y * 1.5, math.rad(-90), 0)
					Resources.RightArmMotor.C0 = CFrame.new(Vector3.new(1, 0.5, 0)) * CFrame.Angles(Resources.Camera.CFrame.LookVector.Y * 1.5, math.rad(90), 0)
				else
					Resources.LeftArmMotor.C0 = CFrame.new(Resources.LeftArmMotor.C0.Position) * CFrame.Angles(Resources.Camera.CFrame.LookVector.Y * 1.5, 0, 0)
					Resources.RightArmMotor.C0 = CFrame.new(Resources.RightArmMotor.C0.Position) * CFrame.Angles(Resources.Camera.CFrame.LookVector.Y * 1.5, 0, 0)
				end
			else
				if Resources.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
					Resources.LeftArmMotor.C0 = CFrame.new(Resources.LeftArmMotor.C0.Position) * CFrame.Angles(0, math.rad(-90), 0)
					Resources.RightArmMotor.C0 = CFrame.new(Resources.RightArmMotor.C0.Position) * CFrame.Angles(0, math.rad(90), 0)
				else
					Resources.LeftArmMotor.C0 = CFrame.new(Resources.LeftArmMotor.C0.Position) * CFrame.Angles(0, 0, 0)
					Resources.RightArmMotor.C0 = CFrame.new(Resources.RightArmMotor.C0.Position) * CFrame.Angles(0, 0, 0)
				end
			end
			if SendOut >= 4 then
				Resources.Communicator:FireServer(Resources.HeadMotor.C0, Resources.LeftArmMotor.C0, Resources.RightArmMotor.C0, Resources.Camera.CFrame.LookVector.Y)
				SendOut = 0
			else
				SendOut += 1
			end
		end
	end,
	ChildrenChanged = function()
		if Resources.Character:FindFirstChildOfClass("Tool") then
			HasTool = true
		else
			HasTool = false
		end
	end,
}
--Events
RunService.RenderStepped:Connect(Functions.OffsetMotors)
Resources.Character.ChildAdded:Connect(Functions.ChildrenChanged)
Resources.Character.ChildRemoved:Connect(Functions.ChildrenChanged)
--Code

Here is the server-end code

ReplicateToServer = function(player, head, leftArm, rightArm, lookVector)
		if player.Character ~= nil and player.Character.Humanoid ~= nil and player.Character.Humanoid.Health > 0 then
			if player.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 and player.Character.Torso ~= nil then
				player.Character.Torso["Neck"].C0 = head
				player.Character.Torso["Left Shoulder"].C0 = leftArm
				player.Character.Torso["Right Shoulder"].C0 = rightArm
			elseif player.Character.Humanoid.RigType == Enum.HumanoidRigType.R15 and player.Character.RightUpperArm ~= nil and player.Character.LeftUpperArm ~= nil and player.Character.Head ~= nil then
				player.Character.Head["Neck"].C0 = head
				player.Character.LeftUpperArm["LeftShoulder"].C0 = CFrame.new(player.Character.LeftUpperArm.LeftShoulder.C0.Position) * CFrame.Angles(lookVector, 0, 0)
				player.Character.RightUpperArm["RightShoulder"].C0 = CFrame.new(player.Character.RightUpperArm.RightShoulder.C0.Position) * CFrame.Angles(lookVector, 0, 0)
			end
		end
	end,

Any help would be appreciated. Thanks!

Ok I have some more details.

Firstly, I am using a custom animation script instead of the roblox provided one so that way I can use both R6 and R15 rigs and can edit it easily if I needed to.

Second, it appears the source of the issue is the walking and idle animations I created. They both modify the shoulder motor6s, but I have no idea how I can make it so the animations don’t change the offset.

TLDR: How can I make it so animations don’t affect motor6 offsets?

Bumping because I have this exact same problem.

1 Like

I forgot about this, but I found the solution, at least for my game

Disable “Retargeting” in workspace properties

2 Likes

Thank you so much for finding that out. It has been driving me crazy for a long time since trying to add both R6 and R15 into the same game is extremely difficult in some cases.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.