I’m pretty new to animations and I’ve been running into this error where my animation rapidly spams over and over again. Any help would be much appreciated. Heres a gif of the error: https://gyazo.com/39d2a6591eaa941d7f0ee843d7a6896d
Code: (Event)
if Action == "Stun" then
if Player.Settings.Stunned.Value == true then
local Humanoid = Player.Character.Humanoid
Player.PlayerGui.Main.Injured.Visible = true
Player.PlayerGui.Main.Injured.Ringing:Play()
local Animation1 = Instance.new("Animation")
Animation1.AnimationId = "http://www.roblox.com/asset/?id=11904281956"
local Animation2 = Instance.new("Animation")
Animation2.AnimationId = "http://www.roblox.com/asset/?id=11904390771"
local AnimationTrack1 = Humanoid:LoadAnimation(Animation1)
local AnimationTrack2 = Humanoid:LoadAnimation(Animation2)
AnimationTrack1:AdjustSpeed(0.25)
AnimationTrack1.Looped = false
AnimationTrack1:Play()
AnimationTrack1.Stopped:Wait()
Humanoid.WalkSpeed = 0
AnimationTrack2.Looped = true
AnimationTrack2:AdjustSpeed(0.25)
AnimationTrack2:Play()
Player.Character.Humanoid.HealthChanged:Connect(function()
if Player.Character.Humanoid.Health >=40 then
for _,anim in pairs(Humanoid.Animator:GetPlayingAnimationTracks()) do
anim:Stop()
Humanoid.WalkSpeed = 22
end
end
end)
end
end