I want to achieve a pose resetter for R6 rigs.
However, every time that I change the Motor6Ds in my script, the Motor6Ds have a COMPLETELY different C0 and C1 than what is in the script.
This is my code:
local selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("R6 Pose Resetter V1.0")
local scriptButton = toolbar:CreateButton("Reset Pose", "Resets the pose left when you save the game while in an animation, mostly on Moon Animator 2. To use, select a rig then click Reset Pose.", "rbxassetid://89083772378352")
scriptButton.ClickableWhenViewportHidden = false
local activated = false
scriptButton:SetActive(activated)
local function MakeCFrame(positionX : number, positionY : number, positionZ : number, rotationX : number, rotationY : number, rotationZ : number) : CFrame
return CFrame.new(Vector3.new(positionX, positionY, positionZ)) * CFrame.Angles(math.rad(rotationX), math.rad(rotationY), math.rad(rotationZ))
end
scriptButton.Click:Connect(function()
activated = not activated
scriptButton:SetActive(activated)
if activated then
activated = false
scriptButton:SetActive(activated)
end
for _, v in ipairs(selection:Get()) do
if v:IsA("Model") then
for _, i in ipairs(v:GetDescendants()) do
if i:IsA("Motor6D") then
if i.Part0.Name == "HumanoidRootPart" and i.Part1.Name == "Torso" then
i.C0 = MakeCFrame(0, 0, 0, -90, -180, 0)
i.C1 = MakeCFrame(0, 0, 0, -90, -180, 0)
elseif i.Part0.Name == "Torso" and i.Part1.Name == "Head" then
i.C0 = MakeCFrame(0, 1 ,0, -90, -180, 0)
i.C1 = MakeCFrame(0, -0.5, 0, -90, -180, 0)
elseif i.Part0.Name == "Torso" and i.Part1.Name == "Right Leg" then
i.C0 = MakeCFrame(1, -1, 0, 0, 90, 0)
i.C1 = MakeCFrame(0.5, 1, 0, 0, 90, 0)
elseif i.Part0.Name == "Torso" and i.Part1.Name == "Left Leg" then
i.C0 = MakeCFrame(-1, -1, 0, 0, -90, 0)
i.C1 = MakeCFrame(-0.5, 1, 0, 0, -90, 0)
elseif i.Part0.Name == "Torso" and i.Part1.Name == "Right Arm" then
i.C0 = MakeCFrame(1, 0.5, 0, 0, 90, 0)
i.C1 = MakeCFrame(-0.5, 0.5, 0, 0, 90, 0)
elseif i.Part0.Name == "Torso" and i.Part1.Name == "Left Arm" then
i.C0 = MakeCFrame(-1, 0.5, 0, 0, -90, 0)
i.C1 = MakeCFrame(0.5, 0.5, 0, 0, -90, 0)
end
end
task.wait()
end
task.wait()
end
end
print("Pose reset.")
end)
As you can see here, I showed all of the welds inside the rig before I used the pose resetter. Once I used it, the welds were sort of the opposite of the normal R6 welds.
I have tried using a function, however it still didn’t work. I have looked many times on the Creator Hub but cant seem to find anything. Can anybody tell me why it isn’t working?
