Very weird issue with animations

I have a system that takes all the animations i want, and creates animation tracks. For some reason, these animations aren’t always able to stop, and they cause blending which i don’t want. They also still blend even with higher priorities and its like the weight doesn’t even matter. idk what’s going on with these animations. I tried to print the animations currently playing with animator:GetPlayingAnimationTracks(), and it always showed 2.

if pose ~= previousPose then
		for _, v in pairs(animations) do
			while v.AnimationTrack.IsPlaying do --this is just a part of my "trying random stuff until something works"
				v.AnimationTrack:Stop() --this doesn't do anything sometimes. (for example, walking still happens while you're jumping)
			end
		end
		previousPose = pose
		if pose == "Crash" then
			local otherPoses = {}
			for _, v in pairs(hurtPoses) do
				table.insert(otherPoses, v)
			end
			if previousHurtPose ~= nil then
				table.remove(otherPoses, table.find(otherPoses, previousHurtPose))
			end
			local chosenPose = otherPoses[math.random(1, #otherPoses)]
			chosenPose.AnimationTrack:Play(0)
			previousHurtPose = chosenPose
		else
			animations[pose].AnimationTrack:Play(0)
		end
	end

Usually there’s two animations playing at once, and i try to stop every currently playing animation before switching to a different one (pose). There should only be one animation playing at a time.

I’ve tried to stop every single animation before, and that didn’t work.

1 Like
while v.AnimationTrack.IsPlaying do
local newanimation = Instance.new("Animation")
newanimation.AnimationId = v.AnimationId
newanimation.Name = v.Name
	v.AnimationTrack:Destroy()
newanimation.Parent = wherever its stored
end

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