Setting multiple character default animation

I wrote a script to replace the default character animation. But the problem is when I have more than one animation for a state, the animations are not played until the end and they become reset in the middle of the animation track.
Anybody can give any help?

This is my script to add the animations:

wait(3) -- wait for the children to be replicated
local loadedAnims = {}
local ch: Model = script.Parent.Parent
local animate = ch:WaitForChild("Animate")
local keyFrameSequenceProvider = game:GetService("KeyframeSequenceProvider")

local function LoadAnimation(cat, id, keyseq)
	local anim = Instance.new("Animation")
	anim.AnimationId = "http://www.roblox.com/asset/?id=" .. id
	if keyseq and game["Run Service"]:IsStudio() then
		anim.AnimationId = keyFrameSequenceProvider:RegisterKeyframeSequence(keyseq)
	end
	local wei = Instance.new("NumberValue")
	wei.Name = "Weight"
	wei.Value = 1000
	wei.Parent = anim
	anim.Parent = animate[cat]
	table.insert(loadedAnims, anim)
end

for k, v: StringValue in pairs(script:GetChildren()) do
	local keyseq = v:FindFirstChild("KeySeq")
	LoadAnimation(v.Name, v.Value, keyseq and keyseq.Value)
end

--destroy the animtions to return back to the default character amimations
script.Parent.Destroying:Connect(function()
	for k, v in pairs(loadedAnims) do
		v:Destroy()
	end
	loadedAnims = {}
end)

Script child structure