How do I efficiently blend together my own walking animations and ROBLOX's walking animations?

  1. I have a battle system that is supposed to work on regular R6 characters without any edits to the original characters, and it works, however, changing animations from custom to regular is jittery and functions strange.
    The plan was that it changes animation id’s in the character animate script and the animate script handles it, however, it didn’t work as expected, and instead I have to do an inefficient check of animations playing, seeing if the playing animation is walking, and play the custom animation over the regular walking one (so essentially blending animations with a hacky workaround).

  2. The issue is that the method above doesn’t work perfectly, because it plays an intense running animation that’s easy to tell apart from the regular one and it makes you run in place at times, because the script thinks you’re walking (but it’s just the regular walking animation that’s carrying over, even though you came to a stop), and same thing happens when switching back to the regular animations.

Is there a more effective way of doing this without rewriting the whole animate script? Or an alternative to the workaround I made?
Scripts:

function BattleAnimationsEquip()
	local anim = Character:FindFirstChild("Animate")
	if not anim then return end
	anim.walk.WalkAnim.AnimationId = "rbxassetid://4477869471"
	local an = Humanoid:LoadAnimation(anim.walk.WalkAnim)
	---------------------------------- make sure that other animations stop playing, because apparently it doesn't overwrite.
	local playinganims = Humanoid:GetPlayingAnimationTracks()
	for i,track in pairs(playinganims) do
		if track.Name == "WalkAnim" then
			track:Stop() --- stop the regular walking anim,
			an:Play() --- play the custom one.
		end
	end
	----------------------------------
	anim.idle.Animation1.AnimationId = "rbxassetid://4477867869"
	anim.idle.Animation2.AnimationId = "rbxassetid://4477867869"
	anim.jump.JumpAnim.AnimationId = "rbxassetid://4477870746"
	Character.Humanoid.WalkSpeed = 23
	Character.Humanoid.JumpPower = 55
end

Switching back functions the same way, just the animation ID’s are different.

You can use AdjustWeight on an animation to blend it with others playing at the same time.

1 Like

The thing is that I’m using animation priority and it works as expected, the issue lies in the fact that the animation ID overwriting doesn’t work.
Basically what happens is:
Player equips weapon while walking > regular walk stops, custom supposed to be playing but isn’t.
In that scenario, when a player stops and starts walking again, the custom walk animation plays instead of the regular one. I worded my issue poorly.