Heres the code
local Animations = script.Animations
local KeyProvider = game:GetService("KeyframeSequenceProvider")
local Combat_Handler = {
MeleeAnims = {
["L"] = Animations.Melee1,
["LL"] = Animations.Melee2,
["LLL"] = Animations.Melee3,
["LLLL"] = Animations.Melee4,
},
}
function Combat_Handler.getAnimation(Humanoid, sequence)
local length = 0
local keysequence = KeyProvider:GetKeyframeSequenceAsync(Combat_Handler.MeleeAnims[sequence].AnimationId)
local keyframes = keysequence:GetKeyframes()
for i=1, keyframes do
local Time = keyframes[i].Time
if Time > length then
length = Time
end
end
return Humanoid.Animator:LoadAnimation(Combat_Handler.MeleeAnims[sequence]),length
end
return Combat_Handler
