Hi so I have an emote system when I spam animations while walking/running This bug happens:
https://gyazo.com/e6741cdb5ea08d5c9c61d0831c8100eb
Heres the scripts:
local function ClearAnimationTracks(Humanoid)
for i,v in pairs(Humanoid:GetPlayingAnimationTracks()) do
print(v)
while v.IsPlaying do -- will always stop the animation, no matter what.
v:Stop()
v:Destroy()
end
end
end
local function LoadAnimation(AnimationId,looped)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
ClearAnimationTracks(Humanoid)
if animdebounce == false then
animdebounce = true
Animator = Humanoid:WaitForChild("Animator")
Animation = Instance.new("Animation")
Animation.AnimationId = AnimationId
print(AnimationId)
AnimationTrack2 = Animator:LoadAnimation(Animation)
AnimationTrack2.Priority = Enum.AnimationPriority.Action
AnimationTrack2:Play()
AnimationTrack2.Stopped:Connect(function()
AnimationTrack2:Destroy()
end)
Humanoid.Running:Connect(function(speed)
if speed >= 0.0001 then
if AnimationTrack2 then
AnimationTrack2:Stop()
AnimationTrack2 = nil
end
end
end)
AnimationTrack2.Stopped:Connect(function()
animdebounce = false
end)
end
end