Here's my code
local Figure = script.Parent
local Torso = Figure:WaitForChild("Torso")
local Humanoid = Figure:WaitForChild("Humanoid")
--All cycle animations
wait(1)
WalkAnimation=Humanoid:LoadAnimation(script.WalkAnim)
IdleAnimation=Humanoid:LoadAnimation(script.IdleAnim)
JumpAnimation=Humanoid:LoadAnimation(script.JumpAnim)
FallAnimation=Humanoid:LoadAnimation(script.FallAnim)
LandAnimation=Humanoid:LoadAnimation(script.LandAnim)
Humanoid.Running:Connect(function(sped)
if sped>0 then
if not WalkAnimation.IsPlaying then
--WalkAnimation:AdjustSpeed(/0.1)
IdleAnimation:Stop()
WalkAnimation:Play(nil,nil,WalkAnimation.Length/0.3)
end
else
WalkAnimation:Stop()
IdleAnimation:Play() --When I remove this its fine. But when I add it it does infinite walk cycle
end
end)
Humanoid.StateChanged:Connect(function(oldState, newState)
print(newState)
if newState==Enum.HumanoidStateType.Jumping then
JumpAnimation:Play()
elseif newState==Enum.HumanoidStateType.Freefall then
FallAnimation:Play()
elseif newState==Enum.HumanoidStateType.Landed then
FallAnimation:Stop()
LandAnimation:Play()
end
end)
For some reason the IdleAnimation causes the Walk cycle to happen infinitely. Also I've already changed the IdleAnimation.AnimationId to the one it's suppose to be

1 comment
Is the Animation file property set to looping?