Animation not working when it plays the second time

It will play perfectly the first time the animation is played in game but then if i do the same exact thing again it doesnt work.

what does the animation look like?

What animation state is it? and what are you trying to do.

Im trying to make a power up animation where everytime you hold Q it does the animation

It looks like goku when hes powering up

have it be a looping action and when your done stop the animation. and when you go back replay the animation

Thats how it works right now, ill paste the entire script so u could help me.

local rs = game.ReplicatedStorage
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7329829970"
local pressed = false
rs.Charging.OnServerEvent:Connect(function(player, value)
	pressed = true
	if player.Skills:FindFirstChild("ManaChargeI") ~= nil then
	local char = player.Character
	local track = char:WaitForChild("Humanoid"):LoadAnimation(animation)
		if value == "IsCharging" then
			track:Play()
			local FX1 = game.ReplicatedStorage.ManaCharge:clone()
			FX1.CFrame = char.HumanoidRootPart.CFrame
			FX1.Parent = char
			game.Debris:AddItem(FX1,9999999)
			char.Humanoid.WalkSpeed = 0
			char.Humanoid.JumpPower = 0
			while pressed == true and char.Humanoid.Mana.Value < char.Humanoid.MaxMana.Value do
				wait(.1)
				FX1.CFrame = char.HumanoidRootPart.CFrame
			char.Humanoid.Mana.Value += 1
			end
			
		elseif value == "IsNotCharging" then
			char.Humanoid.WalkSpeed = 16
			char.Humanoid.JumpPower = 50
			pressed = false
			char:FindFirstChild("ManaCharge"):Destroy()
			track:Stop()
		end
	end
end)

when your stopping instead of using track:Stop() do

		for _, track in ipairs(Humanoid:GetPlayingAnimationTracks()) do
			if track.Name == "Animationname" then
				track:Stop()
				break
			end
		end

Omg ur legit a genius idk how u did it but omg u are so smart thank you so much!

1 Like

no problem buddy hope you do good on your game!!!

1 Like