Animations do not transition smoothly with ended event

Hello! I’m using this script, which you can see below.

		DummyAnimTracks["Cheer"..i]:Play()
		DummyAnimTracks["Cheer"..i].Ended:Connect(function()
			DummyAnimTracks["Dance"..i]:Play()
		end)

I can send rest of the script if its necessary, but there were irrelevant parts.

I need to ensure that one animation starts the moment when other one finishes, but as you can see in the example, there’s a strange pause between the animations.

The animation is suitable for a seamless frame-by-frame transition, but when we test it in the game, we don’t get the correct results.




I think we need to see more of the script

one error though is that the :Connect will keep playing the dance animation if it never gets disconnected

it should be replaced with :Once or :Wait

DummyAnimTracks["Cheer"..i]:Play()
DummyAnimTracks["Cheer"..i].Ended:Once(function()
	DummyAnimTracks["Dance"..i]:Play()
end)

-- or could be wait, in a separate thread if needed

DummyAnimTracks["Cheer"..i]:Play()
DummyAnimTracks["Cheer"..i].Ended:Wait()
DummyAnimTracks["Dance"..i]:Play()

Perhaps you should try to use .Stopped() instead of .Ended()
There is a slight difference between the two, which you can look into at the official docs.
https://create.roblox.com/docs/reference/engine/classes/AnimationTrack
.Ended is fired when the animation is FULLY completed, meaning the subject returns back to its neutral pose. While .Stopped is fired when the animation itself finishes (means at the end of the timeline). You can also try adding your own transitions without using the .Stopped() listener.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.