I’m updating the C0 property of the Left Shoulder and Right Shoulder Motor6D to point towards the mouse and that part works, here’s the code for that part which gets ran by RunService.Stepped.
function Weapon:MoveArmsToMouse()
assert(self.Character)
if not (self.Character.Parent) then return end
if not (self.Tool.Parent == self.Character) then return end
local LeftShoulder = self.Character:FindFirstChild("Left Shoulder", true)
local RightShoulder = self.Character:FindFirstChild("Right Shoulder", true)
local MousePosition
local ViewportSize
pcall(function()
MousePosition = ReplicatedStorage.Functions.MouseFunction:InvokeClient(self.Player, "get_pos")
ViewportSize = ReplicatedStorage.Functions.MouseFunction:InvokeClient(self.Player, "get_viewport_data")
end)
if not MousePosition or not ViewportSize then return end
local Y = math.clamp((MousePosition.Y + 105) - (ViewportSize.Y / 2), -10, 30)
LeftShoulder.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, math.rad(-90), math.rad(Y))
RightShoulder.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.rad(90), math.rad(-Y))
end
Then when the tool is unequipped I run this function (I’ve already tested and it runs) which should reset the C0 to it’s original value, but as you can see from the video it does not.
function Weapon:ResetArms()
assert(self.Character)
local LeftShoulder = self.Character:FindFirstChild("Left Shoulder", true)
local RightShoulder = self.Character:FindFirstChild("Right Shoulder", true)
if not LeftShoulder or not RightShoulder then warn("no stuff ig") return end
LeftShoulder.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, math.rad(-90), 0)
RightShoulder.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.rad(90), 0)
end
Here’s the video
Any help is appreciated! Thanks!