How do you make it so that an "animation" is always playing

I’m making a gun system and I need to make it so that you hold guns with two hands and what happens is that it plays when you the gun but then when you walk, it stops. Here is a sample of my code:

tool.Equipped:Connect(function()
	local character = player.Character or player.Character:Wait()
	local hum = character:WaitForChild("Humanoid")
	local Animator = hum:WaitForChild("Animator")

	local holdAnimation = Instance.new("Animation")
	holdAnimation.AnimationId = "rbxassetid://6977809658"

	local holdAnimationTrack = Animator:LoadAnimation(holdAnimation)
	print("Animation Loaded")
	holdAnimationTrack.Priority = Enum.AnimationPriority.Movement
	holdAnimationTrack.Looped = true
	
	holdAnimationTrack:Play() 
end)

Probably because a higher priority animation plays over the animation, it doesn’t have to necessarily be movement, can be action too.

I never understood the whole priority thing, thank you, I’ll try it.

1 Like

Is it a local? Because sometimes the Looped is not replicated.

No, it is not, it’s in a regular script.

Personally, whenever I try to change the properties of animations through a script, it would work only 1/4 of the time. However, what I’ve done to fix this was that I set the property called “Looped” set to true before I uploaded my animation.

  1. When you export through moon animator/roblox’s default animator, you will result with a blue square.

  2. Click the square, and in the properties, set “Looped” to true.

  3. Right click the square, and click save to Roblox. Upload it, and it will be looped.

  4. Also remember to make your priority different depending on what animations you want to play over it/animations you don’t want

1 Like