How to animate mesh part on a gun?

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