Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Motor6Ds do not persist when copying player's character? (Even with Archivable = true)

Asked by
compUcomp 417 Moderation Voter
5 years ago

I'm trying to create a model of a player's avatar holding a tool. I copied the character while running it, stopped the test, and pasted it back into the workspace. The model was pasted fine, but the Motor6Ds didn't seem to be copied over. The joints went to their default state (without any animation). I didn't know if the Transform property of Motor6D was being cleared when I copied the model, so I wrote a script to pack the information into C0 and C1.

local model = workspace.compUcomp -- no need for WaitForChild, if the script is running it exists
local items = model:GetDescendants()
for i = 1, #items do
    if items[i].ClassName == "Motor6D" then
        local dest = script.Parent:FindFirstChild(items[i].Name, true)
        dest.C1 = items[i].C1 * items[i].C0:Inverse()
        dest.C0 = items[i].Transform
        dest.Archivable = true -- this didn't help
    end
end

I have this in a server Script parented to model. This model is a clone of the character, including said tool. I disable it which I disable until my character is fully loaded and equipped with the tool. When I enable it, the "hold tool" animation is recreated flawlessly on the clone. The problem is that I still have the same problem. If I were to copy the clone while the simulation was running and paste it back into studio, it still does not keep the animation.

Answer this question