How do I keep animation from stopping while walking and when I begin it again?

I want to make it so the animation wont be interrupted by itself or player movement. What do I do?

Animation Script

UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProccesedEvent)
	if input.KeyCode == Enum.KeyCode.R then
		
		local Animation = script.Animation
		local Player = game.Players.LocalPlayer
		local Character = Player.Character
		local Humanoid = Character.humanoid
		
		local AnimationTrack = Humanoid:LoadAnimation(Animation)
		
		AnimationTrack:Play()

The Animation
https://www.roblox.com/library/5948204381/HeadShake

Hi,i hope you’re doing fine.

Ok so since the animation has already been exported you’ll have to export it again but before exporting,on the animation editor click the three dots where the exporting button is but instead of clicking it click on set animation priority first and it’ll open a new tab,click on “Action” and then export it.
Now your animation wont be stopped by movement animations

image

image

2 Likes

You can record the TimePosition of the animation and then set it to the TimePosition + Delta after.

Thank you for that but how do I stop the animation from stopping its self

1 Like

You need a debounce value something like this:

PlayingAnim=false


--considering the animation track is defined as Animation

Animation.Stopped:Connect(function()
PlayingAnim=false
end)

function PlayAnimation()
if PlayingAnim then return end 
Animation:Play()
PlayingAnim=true
end 

edit: mistype

Okay I will try it out. Thank You!

1 Like

you can set the set the priority in animation plugin or script

In the output it says “Stopped is not a valid member of Animation”.