Weird animation bug when spamming an animation

  1. What do you want to achieve?
    -Animation working properly

  2. What is the issue?
    -Whenever i spam the animation which is intended, the animation begins to distort.

  3. What solutions have you tried so far?
    -Deleting the animation created by the script and stopping it when clicking again woked, but im still curios why this happens.

Example of the bug:

The script inside the tool: (i lost the one used in the video but it functions the exact same, the animation bug is more visible though)

This is the animation insdie the editor:

image

If anyone knows the cause of this, please let me know as ive had this issue hundreds of times, but ive ignored it until now.

Hey there!

I believe that the issue is within the animations overlapping.

UPD:
I’ve come up with a possible workaround that should work for you:

local anim = Instance.new("Animation")
anim.AnimationId = "" -- Your Anim Id

local character = player.Character or player.CharacterAdded:Wait()
local track = character:WaitForChild("Humanoid"):LoadAnimation(anim)

local function createBeam(pos)
	track:Stop()
	track:Play(1, 1000)
	
	-- Your Code Here
end

-- Your Code Here
1 Like

Yeah so what happens is when you spam click the animation is called to play again before it ended. When you do a regular :Play() with no parameters it has a short built in lean off and in, which tries to smooth out the stopping and starting of the animation. If you do :Play(0) it will start the animation immediately, which may not look good, but it will stop that “glitching” from happening. Also, if you don’t need players clicking that fast, add a debounce that stops them from clicking that fast, thats easier and will 100% work.

The animations are constantly overwriting eachother so when one arm goes down the other goes down, and it’s a whole lot complicated. you should make like a cooldown for the animation. Like when one animation plays it does not allow you to “summon” the animation again until that animation or function ends. Hope this helps