Animation Bug Transition?

Im not really sure how to explain this

local Stab = math.random(1,2)
Animations.Idle:Stop(0)
Animations["Attack"..Stab]:Play(0)
Animations["Attack"..Stab].Ended:Connect(function()
	Animations.Idle:Play(0)
end)

In this instance the animation is playing, but then it will skip to the end of the animation.

I’ve tried using the wait function after the animation has started but it will just wait simultaneously.

If you need more detail let me know.

Thanks!

I am not too sure what the issue is but try this:
local Stab = math.random(1,2)
Animations.Idle:Stop(0)
Animations[“Attack”…Stab]:Play(0)

local sound; – sound playing
local sound = Instance.new(“Sound”, Animations[“Attack”…Stab])
sound.Name = “Sound”
sound.SoundId = “rbxassetid://XXXXXXXXXX”
sound:Play() – your favorite sound

Animations[“Attack”…Stab].Ended:Connect(function()
Animations.Idle:Play(0)
sound:Destroy() – destroy the sound
end)

Another thing, you don’t need to put the End in the name of it, I would just name it Attack