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

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

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

local rp = game.ReplicatedStorage

3 Likes

Hey, could you help me with this issue somehow?

https://streamable.com/nu1vh

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

4 Likes

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

4 Likes

Hmm…useful. i must try this

2 Likes

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!

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

5 Likes

Mind showing some screenshots/gifs of it happeninng? It’s confusing to understand your problem without them.
@Korrow maybe in the future!

3 Likes

Very well explained and very useful. Thank you a lot.

2 Likes

Thanks, would appreciate it! ok

2 Likes

The tool requires a cancollide part since I think the tool falls to the void on the server’s view and completely destroys it while the client sees it as it normally should. While a cancollide part is able to be dealt with, I ideally don’t want to have any cancollide parts.

The biggest issue is the animation not running for any limbs (in my case, I need it to run for the arms). Here is the GIF.

EDIT: Also, if you don’t mind me asking, how would I make an equip animation for the tool? This is meant to be an equipping animation so I do want the last second of the animation to be the player’s animation to hold the sword as well.

3 Likes