Motor6D does not reset current angle when removing Part1 from it. Which happens when unequipping tools. The bad thing about it, is that it replicates to other tools causing wrong rotation.
A video visually showing the issue:
The code i am using to handle grips:
local handleM6DParents = {}
for _, handlePart in pairs(type(self._handle) == "table" and self._handle or {self._handle}) do
table.insert(handleM6DParents,
handlePart.Name == "RightArmAttach" and "Right Arm"
or handlePart.Name == "LeftArmAttach" and "Left Arm"
or "Torso"
)
end
self._tool.AncestryChanged:Connect(function(_, ancestor)
if self.destroying or not getmetatable(self) or not self._owner or not self._owner.Character then
return
end
if ancestor == self._owner.Character then
for i, handlePart in pairs(type(self._handle) == "table" and self._handle or {self._handle}) do
handlePart.Anchored = false
local M6D: Motor6D = ancestor[handleM6DParents[i]]["ToolGrip"]
M6D.C0 = handlePart:GetAttribute("M6DC0") or CFrame.new(0, 0, 0)
M6D.Part1 = handlePart
end
else
for i, handlePart in pairs(type(self._handle) == "table" and self._handle or {self._handle}) do
local M6D: Motor6D = self._owner.Character[handleM6DParents[i]]["ToolGrip"]
M6D.Part1 = nil
handlePart.Anchored = true
handlePart.Position = Vector3.new(0, 0, 0)
end
end
end)
I tried manually handling it but it did not change anything. The only solution i can think about is giving a handle to all tools (possibly), which i can’t do. If you guys know how to fix it or if i am forgetting something, please tell.
Expected behavior
The angle should reset to 0 and should not get replicated to the “Airstrike Order” tool. But removing Part1 before equipping “Airstrike Order” tool, does not reset the angle.