Hello, i have script that make walk animation play when gun equips and i’m walking. Bur when i walk and then unequip gun, then again equip it. Animation simply dont play. No errors, even print is saying that animation is playing currently.
script.Parent:WaitForChild("Equiped").Event:Connect(function(arms) -- arms is a viewmodel, that i get by bindable event
print("Event")
player.Character.Humanoid.Changed:Connect(function()
if arms then
if not runninganim then runninganim = arms.Humanoid:LoadAnimation(arms.Animations.WalkAnim) end
if not fastrunninganim then fastrunninganim = arms.Humanoid:LoadAnimation(arms.Animations.RunAnim) end
runninganim:AdjustSpeed(player.Character.Humanoid.WalkSpeed * 0.05)
if player.Character.Humanoid.MoveDirection.Magnitude > 0 and player.Character.Humanoid.WalkSpeed <= 12 then
if not runninganim.IsPlaying then
runninganim:Play(0.15) -- not playing second time when i walking
running:Stop(0.25)
fastrunninganim:Stop(0.25)
end
elseif player.Character.Humanoid.MoveDirection.Magnitude <= 0 then
runninganim:Stop(0.15)
fastrunninganim:Stop(0.25) -- not playing second time when i running
running:Stop(0.25)
elseif player.Character.Humanoid.WalkSpeed > 12 and player.Character.Humanoid.MoveDirection.Magnitude > 0 then
if not fastrunninganim.IsPlaying then
fastrunninganim:Play(0.25) -- not playing second time when i running
running:Play(0.25) -- not playing second time when i running (player's character animation)
runninganim:Stop(0.15)
end
end
end
end)
end)