I would like to make a gun idle animation

I have been scripting for a little over six months and have been wanting to deeper familiarize myself with the concept of scripting animations - specifically, gun animations.

  1. What do you want to achieve?
    I would like to learn how to make an idle gun animation.

  2. What is the issue?
    Every time I load an animation, the character’s idle animation overrides it. I have tried to set the priority of the animation in the animation editor before exporting it but it does not seem to work.

  3. What solutions have you tried so far?
    I have watched TheDevKings’s video on animations but his also gets overridden.

What do I do? Is it still a problem with the priority? Must I change the animation priority via a Script, with an Enum or something? All responses are well appreciated.


Usually whenever you want to create an animation, you should set the AnimationPriority property to Action (Or something that’s higher than Core) so that it’s able to override all the other default animations & you should use the Humanoid’s Animator object to load the animations

local Tool = script.Parent
local IdleAnim = Tool:WaitForChild("IdleAnim")

    local Character = Tool.Parent
    local Animator = Character:WaitForChild("Humanoid"):WaitForChild("Animator")
    local LoadAnim = Animator:LoadAnimation(IdleAnim)


Do make sure that the animation that you are playing is owned by you, and that you’re able to access it easily

I will try this out. Thank you for the info! :slight_smile:

I added a while loop to play the animation whilst the tool is equipped and to stop when its unequipped. However, when I walk, it looks a bit weird. The character default walk animation overrides the gun animation. What should I do? Is it best to make my own walk animation? Here is my code.

local tool = script.Parent
local IdleAnim = tool:WaitForChild("IdleAnim")
local playAnim 

	playAnim = true

	local character = tool.Parent
	local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
	local loadAnim = animator:LoadAnimation(IdleAnim)

	while playAnim do	

	playAnim = false

Although this would work, I wouldn’t recommend encasing loops inside Equipped events

Instead you can create a couple of local variables outside the Events:

local tool = script.Parent
local IdleAnim = tool:WaitForChild("IdleAnim")
local Character
local animator
local loadAnim

	Character = tool.Parent
	animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
	loadAnim = animator:LoadAnimation(IdleAnim)



I don’t know how much about how animation welds work, but I believe what you could use is Motor6D's instead, and create your own walk animation? So yes

Check that your model is welded as the same as in the animation editor and check that it isn’t anchored.

Try loading the animation from humanoid.

Loading the animation from the Humanoid would make no difference, apart from the fact that Humanoid:LoadAnimation is deprecated & may delay a bit

Just make sure the animation is looped when you create it. Change it’s animationpriority to Action. Then load it into the Humanoid’s Animator.

i can make the idle animation. The only problem now is that when I walk, it looks strange.

Then you should change the priority to Idle. (also make sure it’s looping)

1 Like

Don’t put the code in a loop, just play it once. If the priority is Idle, it will just stay idle until the player moves, and when they stop, it will just play again.

1 Like