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

How would I play the animations?

Very good tutorial, well explained.

EDIT:
i managed to get the animation to play, but the arms have rotated down for some reason

EDIT (2):
Fixed it!
needed to put animation priority as idle

I tried using the Moon Animator with this, same thing.
I’m not sure, but I think it only works with the ROBLOX animation editor

I’m a bit confused on the scripting part. Could someone help me out?
(mostly where to put the scripts and what variables to make and where)

This doesn’t work for me on R15 rigs. Did all the steps but when I rotate the gun, it rotates the body attach part.

1 Like

anyone know how to fix parts not moving? Ive got my idle anim set to idle and my reload set to action. ive tried action 1 2 3 4 but no luck. arms move but no parts will.

Did you check to make sure your animated parts are not welded?

It all works fine for until:
I got my equip animation done right then once it’s done running I wanna switch to an idle animation.
The issue is that the tool is moving to the origin position aka the position it was put in when I created the motor6d in the test dummy. It’s supposed to be somewhere else. I debugged it to see if it is not looping but it is… I’m lost

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:Wait()
end

local humanoid = character:WaitForChild("Humanoid")
local Animator = humanoid:WaitForChild("Animator")

local Anim = Instance.new("Animation", humanoid)
Anim.AnimationId = "rbxassetid://10827727049"

local Anim2 = Instance.new("Animation", humanoid)
Anim2.AnimationId = "rbxassetid://10830372214"

local EquipAnim = Animator:LoadAnimation(Anim)
local ShoulderArmsAnim = Animator:LoadAnimation(Anim2)

script.Parent.Equipped:Connect(function()
	game.ReplicatedStorage.ConnectM6D:FireServer(script.Parent.Musket.BodyAttach)
	character.Torso.ToolGrip.Part0 = character.Torso
	character.Torso.ToolGrip.Part1 = script.Parent.Musket.BodyAttach
	
	EquipAnim:Play()
	EquipAnim.Stopped:Wait()
	ShoulderArmsAnim:Play()
	ShoulderArmsAnim.Stopped:Wait()
	print("Done")
end)

script.Parent.Unequipped:Connect(function()
	game.ReplicatedStorage.DisconnectM6D:FireServer()
end)

ShoulderArmsAnim is the Idle animation, it’s looped and the priority is Action

Does this work on FPS (FirstPerson) Version?

1 Like

yea i checked they werent welded

When i try to use this every thing works but my toll is deleted few seconds after i equip it

Kind of disappointing to me due to two reasons, 1. exploitable 2. useless. Like c’mon remote servers are not reliable to send data from server to client and yup you will need to do it once just for mouse tracking but welding part can be done on server and/with usage of modules.

1 Like

This code is also like 3 years old…

1 Like

Hello, I followed all of your instructions and even checked most or all of the replies but
for some reason the gun gets stuck in my torso. I remember finding a topic about this but I could no longer find it.

What have I tried?

  • Naming the parts or tools I animate the same name I use for the animation.
  • In the script where it inserts a M6D inside the torso instead of naming the M6D “ToolGrip” I named it into “BodyAttach”.
  • I also made sure that I animated the BodyAttach together with the gun model.

Here is the video of the animation:

Here is the video of the game:

I know that the account I use to make the game is different from the account I use in Devforum,
but it’s because I have lots of alt accounts and sometimes even make games in there. Though I will try to transfer the game’s ownership to this account. I also know that this topic is 3 years old but this is the only topic I can relay on when making tool animations.

Edit: I saved the game file and made the game in my main account [the account I am using].
The animation won’t work so I tried to publish the animation using my account and changed the action to action2 [I think changing it was the thing that fixed my solution?]. And my problem was fixed.
The photo of the animation. Now the only problem is how the gun isn’t positioned properly but I believe I could just check the replies in this topic.

one note then i see, because char its dont defined do a error so if a game will have a lot of players will lag a bit so i change the tool script tho fix it

local WeaponTool = script.Parent
local char

script.Parent.Equipped:Connect(function()
	local char = WeaponTool.Parent
	game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach)
	char.Torso.ToolGrip.Part0 = char.Torso
	char.Torso.ToolGrip.Part1 = WeaponTool.BodyAttach
end)

WeaponTool.Unequipped:Connect(function()
	local char = WeaponTool.Parent.Parent.Character
	game.ReplicatedStorage.DisconnectM6D:FireServer()
end)
2 Likes

Don’t use remote events at all, do it from the server.

1 Like

Using a first person viewmodel the gun wont move with the hands.

I’m using easy first person viewmodel script and the arms don’t move the hands how would I fix that?

1 Like

how u do the camera shake when the animations play?

why don’t the scripts work?
im trying to get the animation to work but it isn’t


https://create.roblox.com/docs/reference/engine/classes/Humanoid#loadAnimation

I am having problem animating.
If you could help it would be great
Help