Calculating the speed of the animation returns it as 0 the first time I call the function. But when I call the function a second time it returns the correct value.
local ReloadAnim = tool.Handle.ReloadAnim
local reloadTrack:Animation=game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(ReloadAnim)
local calculatedSpeed = reloadTrack.Length/reloadSpeed.Value
print("p",calculatedSpeed)
reloadTrack:Play()
reloadTrack:AdjustSpeed(calculatedSpeed)
The first time I call the function and adjust the speed, the animation breaks because I try adjusting it with 0. But the 0 also breaks my idle animation. But when I call the function for a second time the reload animation has been adjusted successfully, while the idle animation is still broken.
I don’t have any clue why the function doesn’t work the first time I call it.
I appreciate any help I can get!