-
What do you want to achieve?
For the arm to move up and down with the gun and head. -
What is the issue?
The arm doesn’t move with it. -
What solutions have you tried so far?
I tried changing the M6Ds connected with arms using other CFrame values however I can’t find out how to.
local base3 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
--script.Parent.BodyAttach.CFrame = CFrame.new(script.Parent.BodyAttach.Position, Raycast(Mouse.X, Mouse.Y))
local mouseHit = clientscript.GetMousePos:InvokeClient(player, "Hit").p
local AimLocation = Vector3.new(mouseHit.X, script.Parent.Parent.HumanoidRootPart.Position.Y, mouseHit.Z)
--script.Parent.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.Parent.HumanoidRootPart.Position, AimLocation)
local headPos = character:WaitForChild("Head").Position
local subVarAdjust = -0.5 * (mouseHit - headPos).Unit.Y
local subVarAdjust2 = (0.5 + subVarAdjust) ^ 0.5 * 0.707
local subVarAdjust3 = (0.5 - subVarAdjust) ^ 0.5 * 0.707
local DifferenceCFrame = HumRP.CFrame:ToObjectSpace(Torso.CFrame).Position
local HeadTor = Torso.CFrame:Inverse() * HumRP.CFrame * (CFrame.new(0,1,0) + DifferenceCFrame) * CFrame.new(0, 0, 0, subVarAdjust3 - subVarAdjust2, 0, 0, subVarAdjust3 + subVarAdjust2) * (CFrame.new(0,1,0) + DifferenceCFrame):Inverse() * RootJoint.C0 * RootJoint.Transform * RootJoint.C1:Inverse()
local mainTor = Torso.CFrame:Inverse() * HumRP.CFrame * (CFrame.new(0,1.5,0) + DifferenceCFrame) * CFrame.new(0, 0, 0, subVarAdjust3 - subVarAdjust2, 0, 0, subVarAdjust3 + subVarAdjust2) * (CFrame.new(0,1.5,0) + DifferenceCFrame):Inverse() * RootJoint.C0 * RootJoint.Transform * RootJoint.C1:Inverse()
Neck.C0 = HeadTor * base3
local BodyAttach6D = character.HumanoidRootPart.ToolAttachment
BodyAttach6D.C0 = mainTor