How to animate mesh part on a gun?

  • What are you attempting to achieve? (Keep it simple and clear)
    I am attempting to achieve something like this (I know one is punping a shotgun and one is the hammer going backwards)
    https://gyazo.com/2f39612b255b9a9123f6bb7af49ab2cb
  • What is the issue? (Keep it simple and clear - Include screenshots/videos/GIFs if possible)
    I have no idea how to do it.
  • What solutions have you tried so far? (Have you searched for solutions through the Roblox Wiki yet?)
    I have looked at these:
    How to animate a tool/object with a Dummy in the Animation Editor
    Problem with the tutorial above: First of all it doesn’t show how to animate parts of the gun. Second, it doesn’t show how to do it with a mesh or with a tool.

This is basically the framework of my gun (setup if you like)
https://gyazo.com/56b6f5445bf95cc4b66efe2fad8d6c2c

And yes the top part (hammer) is a different mesh.
https://gyazo.com/49221437971ab7083f490aefa01d1187

So from what I know now, I need to use motor6Ds and rig the gun. But I know neither of those things.

TL:DR
Could you show me how to rig the gun properly with the gun setup that I have, or at least how to rig with a tool. (If not possible another way) And how to then animate the gun, and if possible in the same animation as the character animation. Thank you so much!

Yes, I know I asked something a little similar but I formulated it wrong and people got the question wrong. Please don’t flag my post.

If you didnt see how the hammer went back here is how it looks in real life: click here

7 Likes

If you are following my tutorial that you linked, there is a very easy way to animate other parts of the gun, such as the Magazine or the Hammer or whatever it is.

I’m assuming you have rigged the gun up so that you can begin animating it. Let’s say we want to be able to animate the magazine:

  • Create a Motor6D in the Handle of the gun and call it ‘Mag’
  • Set the Part0 of the ‘Mag’ Motor6D to the Handle
  • Set the Part1 to the gun’s Magazine

If you re-open the animation editor on the rig you should see ‘Mag’ listed as something you can animate as part of the rig.


On a side note, this is the incorrect category for this post as there is no scripting involved here, please move this to the appropriate category (Design Support).

1 Like

I just have a question, I opened the “game” where you did your tutorial, I saw that the gun you were animating was not a tool but just a model with a handle inside. How would I rig the tool? (See picture)

You would proceed the same way you would with a normal model. Be aware that only local models should be animated to this level, while server models should be limited to aiming. Roblox is pretty strict on RemoteEvent/Function limits.
The model is still just a model, no matter what way you use it. A Tool is just an object to ease input control and character appearance change.

You don’t rig the tool. When you animate the model you can use that Animation with a tool. You create Motor6D’s identical to the ones at the time of animating it, so when the player equips the tool the animation will work with it. You have to make sure though that the Motor6D’s in the tool are named the same as the ones in the model.

How would I use that animation inside the tool? Do I need to add some sort of animation controler (not sure what it is, just heard about it) or how would I go about doing that?

Could you just explain step by step? That would mean the world to me!

As I described in my previous post, this is how you do it step by step:

This is what it should look like when done:
image

These are the properties of the Motor6D:

image

Here’s the file up to this point.
WeaponAnimationTutorial.rbxl (22.1 KB)

When you open this up and select the Dummy in the animation editor you should now be able to animate the ‘Mag’ seperately:

3 Likes

So if I want to use that for any other part of the gun I just change the Part1 to whatever I am animating?

And then when I have animated everything I can basically use that one animation and it will play on both the gun and the character?
But I will need to Motor6D the same place as when I rigged it?

Correct.

Also correct. If you want to animate the Mag, and the Hammer for example, you would have two Motor6D’s inside the Handle of the gun. The ‘Mag’ Motor6D should have it’s Part0 as the Handle of the gun Part1 as the Magazine of the gun. The ‘Hammer’ Motor6D should have it’s Part0 as the Handle of the gun and the Part1 as the Hammer of the gun.

Ok great! Thanks for the clarification, ill test it out tommorrow and hopefully accept the answer :slight_smile:

Hey, could you take a look at this?

So everything worked except that I couldnt move the hammer.
I could move the main Handle, but not the hammer. It just wouldnt move!
All the parts in the gun are CanCollide = false and Anchored = false and collisions are turned off.
Here are some pictures and GIFs:

(Video, cant move hammer) (And yes I tried to change the animation time too, no difference!)
https://gyazo.com/6160526e7abafa4f7d6e0f714c12a565

My setup:
https://gyazo.com/f540f1e5bdbb19781bc1fed9cc233b21

https://gyazo.com/a390b32ec7799386d88367b0f7b99817

I would be very gratefull if you could tell me what I did wrong, thank you so much for the help so far!

PS!
The handle is a mesh part, its basically the under part (everything except the hammer). Is that wrong, do I actually need an invisible part?

Can you provide a .rbxl file or something to reproduce?

Here it is:
Motor6D_Test.rbxl (36.0 KB)

Hey! Did the link work?

You could always just make a handle, set the transparency on it to 1, then add the hammer the the handle mesh which will be fake to the real handle which will allow you to animate them seperate.

Edit: Nvm, its probably because you’re using a weld instead of a motor6d.

1 Like

https://gyazo.com/d9ed64e14723fa656928c62701381cd3

Fixed it :smiley:

Remember, if you want a certain part to animate, you’ll need to make it a motor6d to move.

FixedMotor6D.rbxl (36.0 KB)

1 Like

Wow! Thank you so much! Now I can finally make the guns :slight_smile: thanks man!!

Hey, I animated the thing and everything worked. But when I tried to impement it into my weapon only the arms moved and not the hammer (top part)
Why? (I took the Motor6D the same place!)
https://gyazo.com/3d47c1fc4ac3e5941e3dd1df28931722

Apologies for the late reply. Did you put a Motor6D in the RightHand connected to the handle, as well as the hammer?