Problems with Animator:LoadAnimation

Hello I’m making a game with tools where there are multiple different idle animations. The animation keeps loaded after being stopped. I think its because the animation is being loaded more then once but I’m not sure. I cant find a way to fix this

local function EquipAction(actionName, inputState, inputObject)
	if inputState == Enum.UserInputState.Begin then
		IdleAnimHolder = FindEquiptedBlower().Handle.idle
		IdleAnim = hum.Animator:LoadAnimation(IdleAnimHolder)
		useanim = FindEquiptedBlower().Handle.Use
		UseTrack = hum.Animator:LoadAnimation(useanim)
		game.ReplicatedStorage.Remotes.EquiptBlower:InvokeServer()
		if BlowerEquipt.Value == false then
			FindEquiptedBlower().Handle.Blowersound:Stop()
			script.Parent.Parent.LocalSounds.pop:Play()
			IdleAnim:Stop()
			Activated = false
			UseTrack:Stop()
		elseif BlowerEquipt.Value == true then
			script.Parent.Parent.LocalSounds.pop:Play()
			IdleAnim:Play()
		end
	end
end

Here is some of the code. Can someone give me a brief explanation of what I can do to fix this? Thanks.

1 Like

I have figured this out. Thanks

If you have figured out a solution, perhaps you could explain what went wrong. That should assist future developers who are also experiencing the same issue.

1 Like

I Just took out the idle animation because it looked nicer with out it and saved time.

2 Likes

Future developers should use a different method for creating animations and try not to load the animation multiple times.

1 Like