Looped animation on rig quickly reverts or "jolts" back to the default position before continuing to loop

Exactly as the title states; My rig quickly jolts back to the default “no animation” pose between animation loops. The animation is priority 4 and is looped.

Here is my script:

local hum = script.Parent:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local animation = script:WaitForChild("Blacksmith")
local debris = game:GetService("Debris")

local animTrack = animator:LoadAnimation(animation)
animTrack:Play()

-- Function to trigger spark and sound
local function triggerEffects()
	local sparkPart = hum.Parent:FindFirstChild("SparkPart")
	if not sparkPart then return end

	for _, v in pairs(sparkPart:GetChildren()) do
		local sounds = script.Sounds:GetChildren()
		local randomSound = sounds[math.random(1, #sounds)]:Clone()
		randomSound.Parent = v.Parent
		randomSound:Play()
		debris:AddItem(randomSound, 1)

		if v:IsA("ParticleEmitter") then
			v:Emit(50)
		end
	end
end

-- Detect Strike keyframe
animTrack.KeyframeReached:Connect(function(keyframe)
	if keyframe == "Strike" then
		triggerEffects()
	end
end)

Tweak the weight of the animation or increase the fadeTime parameter within track:Play()
track:Play(fadeTime, weight, speed) if I remember correctly

Alternatively it could be some strange issue with how you animated the character; try putting the initial (or idle) pose as a keyframe at the end

1 Like

Tried it and it didn’t work, then realized I’m not the brightest, and that Roblox defaults ALL parts back to their original positions if they don’t have a keyframe at the start. Went through and manually added a keyframe for every body part.

1 Like

seems like you solved your problem. mark your reply as the solution

1 Like

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