How to animate Tool Parts (Guns, Knifes etc.)

OK, I should be able to show you step by step on how I did it with screen shots. Or the places where I messed up.

5 Likes

I think that it’s HumanoidRootPart that you want instead of upper torso - HRP behaves like R6’s Torso part.

5 Likes

How can this be applied to R15 characters and Using Moonsuite as an animator?

5 Likes

I haven’t explore Moon Suite in detail so far - But I tried to follow the same steps with Moon Suite, I stopped at the animating part and it works fine, not sure does it work after it’s being exported.

5 Likes

The animation is playing, but the tool isn’t playing it’s animations.

This is what it’s showing in the editor:
https://gyazo.com/4e4f375357dac282bee651dc24d67fb9

This is what it’s showing in game:
https://gyazo.com/1e41c30e571f955fb33f8149655af137

Here is the script that plays it:

script.Parent.Equipped:Connect(function()

	attachEvent:FireServer(script.Parent:WaitForChild("48"), "Attach")
	
	character = player.Character or player.CharacterAdded:Wait()
	humanoid = character:WaitForChild("Humanoid")
	if not idleAnim then
		idleAnim = humanoid:LoadAnimation(script:WaitForChild("IdleAnimation"))
	end
	idleAnim.Looped = true
	repeat wait() until character:WaitForChild("ToolGrip").Part1 ~= nil
	idleAnim:Play()
end)

Yes, I know it’s welded to the hand, but I’m not the animator. The animator had welded it to the hand and I’m just doing the scripting.

8 Likes

Make sure no weld is connected to anything? Mind screenshoting the explorer structure?

5 Likes

Why there are dots in the script are those necessary?
Where does the server script go?
https://gyazo.com/5f8766a62a119663443e85d0565b56a0 All this unkown warnings. Dont I have to do something here?

3 Likes

Please, the code above is for reference only. I gave the basic root and the structure of how it should works, but you have to define variables by yourself! Everyone has a different code.

6 Likes

image

Here is the explorer

3 Likes

You have the structure when it’s being equipped? Show as many descendants as you can.
By the way I do not recommend use welds.

Seems that you missed this step, it might not be the root cause of the problem that you’re having, but just a reminder.

3 Likes

The M6D that connects the body and the tool has part0 as the hand and part1 as the handle.

I made all the welds into M6Ds

4 Likes

Just a question. The gun has to already have a firing script to shoot and reload animations inside of it right?

4 Likes

Animations are not necessary and they will still function without them, but you will see your weapon stuck in the torso if you follow the steps above.

3 Likes

Does the object being in the animation editor and the object equipped have to be the exact same?

4 Likes

The animation will play no matter your custom welded object exists or not. Just make sure you have the same names on your models. I think animations play base on the object’s name, even with a completely different model.

4 Likes

I also had gotten the same problem. I am relatively very new at this, but this is what my tool looks like in workspace and the script inside.

Script:

script.Parent.Equipped:Connect(function()

rp.ConnectM6D:FireServer(WeaponTool.BodyAttach)

char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = WeaponTool.BodyAttach

...

end)

WeaponTool.Unequipped:Connect(function()

rp.DisconnectM6D:FireServer()

end)

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)

	local M6D = Instance.new("Motor6D", char.Torso)
	M6D.Name = "ToolGrip"
    ...

game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)

  local char = plr.Character
  char.Torso.ToolGrip.Part0 = char.Torso
  char.Torso.ToolGrip.Part1 = location

end)

game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
plr.Character.Torso.ToolGrip.Part1 = nil
end)

I am using R15 character rigs. I understand putting the M6D in the HuminoidRootPart instead of a Toros [Like R5]. I also have the 2 remote events in Replicated Storage - DisconnectM6D, ConnectM6D.

Worksapce1

Any help or suggestions to what I am doing incorrect would be appreciated. Thank you. I am also new to posting so anything needing clarification on this post just ask.

7 Likes

This is a great and detailed tutorial, this is a great animating recourse and I’m sure it helped a lot of people!
you did a great job explaining tool animations :upside_down_face:

4 Likes

Please check for output to see is there any errors, plus turn off RequiresHandle. You might also like to take a look at the explorer and check is there any Motor6Ds.

5 Likes

Thank you for the response, I didn’t think to look at my Command Output.
I have followed what my Command Output has said, but now I am getting ‘rp’ (a nil value)
CommandOutput

I am pretty sure I am missing something major. But I am scratching my head as to what.

2 Likes

Please, define variables by yourself! rp is referenced to ReplicatedStorage. Please also be sure that you did put Remote Events.

3 Likes