Animation glitching?


I hope i uploaded the right video but uh as you can see its glitching? I dont know what could be causing this heres the script

local animations = {"133276857812612"} -- put ur animation ids here
local CanAttack = true

script.Parent.Activated:Connect(function()
	if CanAttack == true then
		local animation = Instance.new("Animation",  script.Parent.Parent)
		animation.AnimationId = "http://www.roblox.com/asset?id="..animations[math.random(1, #animations)]
		local chosenanim = script.Parent.Parent.Humanoid:LoadAnimation(animation)
		chosenanim:Play()
		CanAttack = false
		wait(chosenanim.Length)
		CanAttack = true
	end
end)
1 Like

use formatting to make the pasted script neater and easier to understand (```)

like
this

Anyway, Is the problem that the animation doesnt stop playing? If so, make sure to reupload the animation but with the looping disabled. And if it behaves weirdly with other animations, make sure to change the priority to something higher or increase it’s weight.
(Assuming you own the animations)

1 Like

so i would add what to the script to make it stop looping?

1 Like

Do you own the animation? If so, make sure to disable the looping and reupload.

If not, make sure to use :Stop()

Ohh yes i own the animation thanks so much bro this makes so much sense now thanks man

1 Like

Mark it as the solution if it works so people know your issue is solved.