How to animate mesh part on a gun?

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?

No problem :slight_smile:
Yeah I took a motor6D in the RightHand connected to the handle + handle connected to hammer.
But on my tool I only have one motor6D, handle connected to hammer. Should I use a script to make a motor6d that connects the handle to the players right hand whenever it is equipped?

Here are some videos:

Rig setup:
https://gyazo.com/56cafcc1cfe18fe2fdb1e174669e07d6
Tool setup:
https://gyazo.com/a678c01b24fabe11965602616e84b58f
Animation in animation editor: (slowed down for illustrative purposes)
https://gyazo.com/25e07d4a8507e22a684763dce44e8d92
Animation in studio/game: (slowed down, only left arm moves…)
https://gyazo.com/b7a921f869035f59106945a9a2a15974

This didn’t work either
https://gyazo.com/7995584a310a51b01474b97d0286b467

Yes you need a Motor6D in the RightHand connected to the Handle otherwise it won’t work. If you remember, the Handle is the main part that represents the whole gun in the Animation editor.

1 Like

I do have a Motor6D in righthand-handle. But, not in the tool that i equipped. Should I use a script then? But I tried to use a script and it didnt work. If you look at my GIFS that I posted just a few minutes ago, maybe you get an idea?

Yea, you’ll have to script it to where it replaces the weld with a motor6d.

Luckily, somebody has made an answer to that. Credits to the person who made the script :stuck_out_tongue:

You can’t just copy the motor6d into another part, you’ll have to set it up.

Also, I use these plugins for when I’m animating and changing joints. Makes life so much more easier.

You can go onto youtube to learn how to use them :smiley: Moon Suite Animation also provides an offical tutorial on their page.

Here’s a really simple script to replace the RightGrip with a Motor6D. Place it inside your tool.

local Motor6DName = "Handle" -- Set this to what the Motor6D was called while animating.

local localPlayer = game.Players.LocalPlayer
local plrCharacter = localPlayer.Character
local plrHumanoid = plrCharacter:WaitForChild('Humanoid')
local rightHand = plrCharacter:WaitForChild("RightHand") or plrCharacter:WaitForChild("Right Arm")
	
script.Parent.Equipped:connect(function()
	local origGrip = rightHand:WaitForChild("RightGrip")		
	local Motor6D = Instance.new("Motor6D")
	
    -- Setting up the Motor6D to replace the grip
	Motor6D.Name = Motor6DName
	Motor6D.Part0 = origGrip.Part0
	Motor6D.Part1 = origGrip.Part1
	
    -- Replacing the grip with the Motor6D
	origGrip:Destroy()
	Motor6D.Parent = rightHand
end)
1 Like