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

image

Here is the explorer

2 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.

2 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

3 Likes

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

3 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?

3 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.

3 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.

6 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:

3 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.

4 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.

1 Like

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

2 Likes

rp is the replicated storage,
You just need to make a variable

local rp = game.ReplicatedStorage

2 Likes

Hey, could you help me with this issue somehow?

https://streamable.com/nu1vh

2 Likes

I think this is a Roblox animation editor bug, sometimes it works but sometimes it doesn’t. Or maybe you should try switching local and world axis by hitting Ctrl+L.
If you want to move the model, you can just move the BodyAttach since other parts are connected to it.

3 Likes

Can it be used for another Gun kit Like FE Gun kit?

3 Likes

Hmm…useful. i must try this

1 Like

Good method, I have tested your method with Moon Suite, with many different melee type weapons and also guns.

I didn’t have one issue due to prior knowledge at scripting and I didn’t really need any support here, thank you for sharing!

4 Likes

Although, if you have time do you mind making a viewmodel tutorial as well cause I read your older post of when you needed help with a view model, since I want to learn how to do it properly a proper guide will be nice (Even with R6)

4 Likes

When I tried to animate a tool like this, my animation plays but it does not animate the arms and the tool destroys itself after the animation is over. The animation executes with the weapon animating exactly as it would but nothing else animates then is destroyed. My code is almost the same as the example code with the exception that I am handling two motor6Ds. Any idea how I can fix this?

EDIT: The issue was due to cancollide being off for all parts, I had to set the attachment parts that are connected to the torso with their cancollide on but it still doesn’t animate any limbs. I think the server doesn’t properly see it connected to the tool to the character like the client does and that if you have it all on cancollide off, it will fall into the void.

4 Likes