I’m trying to track an animation to convert it into a CFrame animation. But when I change the CFrame of any part in the player it either doesn’t move or the player dies (The player dies when I remove the motor6ds)
Script:
local Animation1 = script.Parent.Humanoid:LoadAnimation(script.Animation)
local CF_Log = {0}
local Part_Names = {""}
Animation1:Play()
local function weld(p0, p1, parent)
local weld = Instance.new("WeldConstraint", parent)
weld.Part0 = p0
weld.Part1 = p1
weld.Name = p1.Name
end
for i = 0, 1, .1 do
wait()
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("Part") then
CF_Log[#CF_Log+1] = v.CFrame
Part_Names[#Part_Names+1] = v.Name
end
end
end
wait(1)
print(CF_Log)
local root = Instance.new("Part", script.Parent)
root.Anchored = true
root.CFrame = script.Parent.HumanoidRootPart.CFrame
root.Name = "root"
script.Parent.HumanoidRootPart:Destroy()
for i, v in pairs(script.Parent:GetDescendants()) do
if v:IsA("Motor6D") then
v:Destroy()
elseif v:IsA("Part") then
weld(root, v, root)
end
end
for i, v in pairs(CF_Log) do
wait()
local Part = script.Parent:FindFirstChild(Part_Names[i])
if Part and Part.Name ~= "HumanoidRootPart" and Part.Name ~= "Torso" then
Part.CFrame = v
print(Part.Name)
end
end
It might be a weird request but since animations can’t run on a game that the creator of the animation didn’t make I need to convert the animation into a script.
I know that there a plugins for this but i’m really just experimenting to see if this can work.
If it can’t just tell me why. Thanks!