Looped animation refuses to stop?

  1. What do you want to achieve?
    Energy Wave (like dragon ball) system

  2. What is the issue?

When the InputBegan is started, the Charging looped animation is played and a remote event is fired onto the server

When the InputEnded is fired, the Charging looped animation is stopped and the Release animation is played and a remote event is fired onto the server

When the server fires back a remote event, the player is given a wait for a cooldown, the Release animation should be stopped but it doesn’t stop? The events are working fine, it’s just stopping the animation that is the problen

  1. What solutions have you tried so far?

I tried checking if the animation is playing, but it prints false yet the animation is visibly playing
local script in StarterCharacterScript:

local Player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local rp = game:GetService("ReplicatedStorage")
repeat wait() until script.Skill1
local Kameha = script.Skill1
local active = false
local debounce = false
repeat wait() until Player.Character
local Character = Player.Character
local Hold = Player.Character.Humanoid:LoadAnimation(script.Skill1.Skill1.Hold)
local Release = Player.Character.Humanoid:LoadAnimation(script.Skill1.Skill1.Release)
local cooldown = 10

UIS.InputBegan:Connect(function(Input,isTyping)
	if isTyping then
		return
	elseif Input.KeyCode == Enum.KeyCode.One then
		if debounce == false and active == false then
			debounce = true
			Kameha:FireServer(active)
--------------------------------------------------------------------------
			Hold:Play()-- play charging animation works
--------------------------------------------------------------------------
			script.Skill1.Skill1.RemoteEvent:FireServer()
		wait(10)	
		end
	end
end)

UIS.InputEnded:Connect(function(Input,isTyping)
	if isTyping then
		return
	elseif Input.KeyCode == Enum.KeyCode.One then
		if debounce == true and active == false then
			active = true
			Kameha:FireServer(active)
----------------------------------------------------------------------------
			Hold:Stop() -- stop charging animation works
			Release:Play()-- play Firing animation works
----------------------------------------------------------------------------
			script.Skill1.Skill1.RemoteEvent:FireServer()
		wait(10)		
		end
	end
end)

Kameha.OnClientEvent:Connect(function()
	wait(cooldown)
	debounce = false
-----------------------------------------------------------------------------
	Hold:Stop()-- stop hold animation just in case
	Release:Stop() -- the problem, this animation doesn't stop
-----------------------------------------------------------------------------
	active = false
end)
1 Like

I had the same problem with a crouch animation. I just made 2 scripts, one to crouch and one to uncrouch. (for you would be one to charge and one to release). However, you can also just have the script delete the animation then clone it from somewhere else back to the player so that it forces the animation to stop. As of right now, I do not know of any actual way to fully stop looped animations.

You have to give :Stop() a exit code of 0 so :Stop(0) also make sure you aren’t looping stop or play

1 Like

Thanks, adding the exit code worked, but for some reason I had to Stop Both of the animations twice

Yea it only stops the animation track

Thank you also. That really comes in handy.

1 Like

My first comment :D! I’m so excited. Thank you for the :Stop(0) btw.

1 Like