R15 Equivalent of the Neck, Left Shoulder and Right Shoulder?

Trying to convert this script that makes my character follow the mouse but it’s only compatible with R6. I tried changing the variable “Neck” to “NeckAttachment” as that was the only thing I could find that was related to the neck but I get the error message “CO is not a member of Attachment” on line 19 (which I have marked).

   local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:wait() ; Character = Player.Character

local Torso = Character:WaitForChild("UpperTorso")

local Neck = Torso:WaitForChild("NeckAttachment")

local LeftShoulder = Torso:WaitForChild("LeftShoulderRigAttachment")

local RightShoulder = Torso:WaitForChild("RightShoulderRigAttachment")

local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.AutoRotate = false

local HMR = Character:WaitForChild("HumanoidRootPart")

local Mouse = Player:GetMouse()

local RC0 = CFrame.new(1, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)

local RC1 = CFrame.new(-.5, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)

local LC0 = CFrame.new(-1, .5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)

local LC1 = CFrame.new(.5, .5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)

local NeckC0 = Neck.C0 --Line 19

local NeckC1 = Neck.C1

game:GetService("RunService").RenderStepped:connect(function()

local cf = workspace.CurrentCamera.CFrame.lookVector.Y

local Kek = CFrame.Angles(0, 0, math.asin(Mouse.Origin.lookVector.Y))

RightShoulder.C1 = RC1 * Kek:inverse()

LeftShoulder.C1 = LC1 * Kek

Neck.C0 = NeckC0 * CFrame.Angles(math.asin(Mouse.Origin.lookVector.Y), 0, 0):inverse()

HMR.CFrame = CFrame.new(HMR.Position, Vector3.new(Mouse.Hit.p.x, HMR.Position.Y, Mouse.Hit.p.z))

end)
1 Like

Try Head.Neck

UpperLeftArm.LeftShoulder

UpperRightArm.RightShoulder

They are suppose to be Motor6Ds not Attachments


Please Indent your code man it’s easier to read that way

if true then
print('Not Indented')
end

if true then
   print('Indented')
end

The Script Editor Automatically indents for you so don’t remove it

If you are worried about the Space (White Space) effecting the Script’s Performance then don’t


If you don’t Indent you code it will look even worse than this

A Nightmare
if true then
elseif true then
while wait() do
end
else
if true then
elseif true then
else
if true then
for i = 1 , 10 do
print(i)
for ii = 1 do 10 do
print(ii)
end
end
if true then
Event:Connect(function()
end)
end
elseif true then
if true then
spawn(function()
end)
elseif true then
local Table = {'I',
'am',
'not',
'Indented!'}
end
end
end
end
3 Likes

Worked but now my arms mangle and don’t move in the intended direction. For example, when I look up my arms twist and clip through eachother.

I do have a hold animation that is constantly looping when the gun is equipped.

No idea how to fix that, CFrame is not my Expertise yet.