Why is this animation script not working?

@MineGameIdle is incorrect, Humanoid:LoadAnimation() is deprecated and is now recommanded to use Humanoid.Animator:LoadAnimation()

source: Deprecating LoadAnimation on Humanoid and AnimationController

As for the issue the problem is the if statement
if not walkingaTrack:Play() then
Use this instead
if not walkingaTrack.IsPlaying then

Thirdly you need to update your state variable, because its outside of the function it will save the value of whatever state it is during that call and never change and also its a function so you need to do Humanoid:GetState() (make sure to put it inside of the function)

Also your comparsion of the state is incorrect, GetState() wil return a Enum so you need to do something like

if Humanoid:GetState() == Enum.HumanoidStateType.Landed then

1 Like