Animation stops playing when I move

Hello,
I’m trying to make a button that plays an animation. Everything works but when I move the animation stops. I have set the priority of the animation to Action when uploading it, and made sure that the animation is looped.

Here is my code that plays the animation:

-- Variables
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local radioToggleAnimation = Instance.new("Animation")
radioToggleAnimation.AnimationId = "rbxassetid://6605917300"

-- The code inside a MouseButton1Click function that plays the Animation
toggleAnimation = humanoid:LoadAnimation(radioToggleAnimation)
toggleAnimation:Play()
toggleAnimation.Looped = true

H u h

Is this on a LocalScript when the player hits the button? Also if possible I’d recommend using the Animator object inside the Humanoid?

-- Variables
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local radioToggleAnimation = Instance.new("Animation")
radioToggleAnimation.AnimationId = "rbxassetid://6605917300"

-- The code inside a MouseButton1Click function that plays the Animation
toggleAnimation = humanoid:LoadAnimation(radioToggleAnimation)
toggleAnimation:Play()
toggleAnimation.Looped = true
1 Like

Yes, this is on a LocalScript and mhm I’m confused too

Try changing the toggleAnimation variable to a local variable? Unless if it’s local outsided the event

1 Like

Still not working after trying that…

I have re-uploaded the animation and now it decides to work :upside_down_face:, thanks for the help!

1 Like

Maybe try setting the animation priority to Movement? Sounds strange but that does work for me sometimes.

1 Like

Weird, maybe it was just a bug of some sort?

Regardless, glad it’s fixed! :sweat_smile:

1 Like

When making custom animations, I think you should always set it to Action so it bypasses all existing anims. (I have no idea why roblox sets the priority to Core in the animation editor, literally no one uses Core.)

1 Like