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

I cant really get to think how they would get an advantage by exploiting this? Is it because they can make weapons using this? Im not really sure, i want to make sure so i can use the correct server checking.

1 Like

Thats happened to be me before, but I think there really is nothing you can do about it. I think that happeneds because of the rig, the tool handle or bodyattatch is inside of the RightArm, so roblox thinks that during the animation, the tools handle is in the characters arm, then realizes the position is wrong, then fixes it.

3 Likes

Hey there! I seem to have faced the same problem, mind if you share how you fixed this?
Thanks!

1 Like

What do you mean? Tryin taking out the tool

1 Like

The knife parts.

This text will be blurred

1 Like

Why my tool become invisible? once I try to put the tool parent to the character?

1 Like

Can you link the cheat they used (learning purposes only)

2 Likes

This is super! So do you have to use a looped animation for the idle animation when equipping the gun?

1 Like

Nvm I fix it already but thanks for tryin to help

1 Like

Hello, this tutorial as been tremendously helpful and I have had a great time with animating tools.
However, I encountered two issues:

Thank you for your time.

Edit: well, it appears that the animation not lining up problem was purely my fault and not the tutorial’s. I had forgotten to stop the idleAnim when the fireAnim was activated causing the fireAnim and the idleAnim to override each other and cause problems. sorry for taking precious time over something that was easily prevented.

1 Like

One think I noticed is that the part being animated must not be named “Handle”, or it will stick to the hand and not playing the animation

1 Like

How about an rotate like-connection? Can i just freely edit the 6DMotors without being worried that it would ruin?

For Example ^

1 Like

I am making a sword, there is an issue that sword is not in right place.

How it looks in animation editor: https://gyazo.com/07d085b605b973003ad0cb61f0978baf
How it looks in game: https://gyazo.com/d8cb586ad82f50e60f149119f7c95395

I’d like to hear advice, Thanks.

2 Likes

To everyone who still suffers from an issue where tool is being not in the right place:

You might wanna try getting BodyAttach part into the right direction, just like with classic handles of tools. I myself am marking front faces of them with a hinge, and then rotate everything from there. You can use decals, built-in orientation indicator or whatever else you prefer.

4 Likes

For some reason, whenever my character dies and then when I equip the tool again the pistol does not show up in the characters hands and just falls out of the map. I think its something that I did wrong but im gonna go check again

1 Like

i’ve got issues
first issue is the gun isn’t in the correct place when i equip it
and second the gun teleports to the torso when it should be in the hand
and lastly the animation for the gun sometimes plays

i am going to do more complicated animations later,

How would I even hold it in the first place? like a holding idle animation. Could anybody link a tutorial of that or direct me on how to do it? thanks.

a localscript that plays the idle animation will give you the result I assume you want

script.Parent.Equipped:Connect(function()
	idleAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.IdleAnimation)
	idleAnim:Play()
end)

script.Parent.Unequipped:Connect(function()
	idleAnim:Stop()
end)

however, do mind that Humanoid:LoadAnimation() is deprecated.

Does anyone know why this happens?

nvm if found the soulution

Hello I have follows your tutorial step by step, but when I play the animation the arms are animating but the gun isn’t at right place

photos:


(in Animator)
(ik my animation is trash i’ve never animated K!)


(in game)

Same from server’s POV

Here’s the script
Client:

--Made by Beastcraft_Gaming

--Variables--

--Services
local replicatedStorage = game:GetService("ReplicatedStorage");
local CAS = game:GetService("ContextActionService");
local Players = game:GetService("Players");

--Player Variables
local player = Players.LocalPlayer;
local character = player.Character or player.CharacterAdded:Wait();
local humanoid: Humanoid = character:WaitForChild("Humanoid");
local RightArm = character:WaitForChild("Right Arm");

local Animator = Instance.new("Animator", humanoid);

--Event Folder
local eventFolder = replicatedStorage:WaitForChild("Events");

--other folders
local gunFolder = eventFolder:WaitForChild("GunEvents");

--Gun Events
local equipEvent = gunFolder:WaitForChild("EquipEvent");


--Folders
local gunsFolder = replicatedStorage:WaitForChild("GunsFolder");

--Tables
local GunsTable = gunsFolder:GetChildren();
local BindTable = require(script.Parent:WaitForChild("KeyBindings"));

local function equipTool(name)
    
    equipEvent:FireServer(name);
end

for key,gunName in pairs(BindTable) do
    CAS:BindAction(gunName, equipTool, false, Enum.KeyCode[key]);
end

Server:

--Made by Beastcraft_Gaming

--Variables--

--Services
local replicatedStorage = game:GetService("ReplicatedStorage");

--Event Folder
local eventFolder = replicatedStorage:WaitForChild("Events");

--other folders
local gunFolder = eventFolder:WaitForChild("GunEvents");

--Gun Events
local equipEvent = gunFolder:WaitForChild("EquipEvent");

--Main

equipEvent.OnServerEvent:Connect(function(player, name)
    local gunsFolder = replicatedStorage:WaitForChild("GunsFolder");
    local tool: Tool = gunsFolder[name]:Clone();
    
    --Player Variables
    local character = player.Character or player.CharacterAdded:Wait();
    local humanoid: Humanoid = character:WaitForChild("Humanoid");
    local RightArm = character:WaitForChild("Right Arm");

    --Equip the gun
    if not character:FindFirstChild(tool.Name) then
        tool.Parent = player.Character;
        humanoid:EquipTool(tool);
    end

    --Rig The tool
    local bodyAttach = tool:WaitForChild("BodyAttach");

    local motor = Instance.new("Motor6D", RightArm);
    motor.Part0 = RightArm;
    motor.Part1 = bodyAttach;

    --Create Animator
    local Animator = humanoid:FindFirstChildOfClass("Animator");
    
    if not Animator then
        Animator = Instance.new("Animator", humanoid);
    end
    
    --Play equip animation
    local equipAnim = tool:WaitForChild("Animations"):WaitForChild("Equip");

    local equipTrack = Animator:LoadAnimation(equipAnim);
    equipTrack:Play();

end);
1 Like