Trying to change CFrame of player parts but it doesn't work

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!

I believe you still need the actual keyframes to play other people’s animations. You should be able to just use those to animate via a script though.

Edit: Also try disabling the animation script in the character and try disabling the death state for their humanoid when trying to animate them.

1 Like

Any time you remove a players head they die.

How would I play a keyframe from a script?